-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathclient_test.py
46 lines (33 loc) · 1.17 KB
/
client_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import pprint
from testify import *
import blueox
from blueox import client
class SimpleGrouperTest(TestCase):
@setup
def build_stream(self):
events = [{'id': 1, 'type': 'foo.bar', 'body': 'Hello World'},
{'id': 1, 'type': 'foo', 'body': 'All Done'}]
self.stream = (event for event in events)
@setup
def build_grouper(self):
self.grouper = client.Grouper(self.stream)
def test(self):
output = list(self.grouper)
assert_equal(len(output), 1)
assert_equal(len(output[0]), 2)
assert_equal(self.grouper.size, 0)
class MaxGrouperTest(TestCase):
@setup
def build_stream(self):
events = [
{'id': 1, 'type': 'foo.bar', 'body': 'Hello World'},
{'id': 2, 'type': 'foo.bar', 'body': 'Hello World 2'},
{'id': 1, 'type': 'foo', 'body': 'All Done'}]
self.stream = (event for event in events)
@setup
def build_grouper(self):
self.grouper = client.Grouper(self.stream, max_size=1)
def test(self):
output = list(self.grouper)
assert_equal(len(output), 1)
assert_equal(len(output[0]), 1)