@@ -34,8 +34,7 @@ class TestEventFabric(unittest.TestCase):
34
34
35
35
def test_client_creation (self ):
36
36
"test that the client is created and parameters are set correctly"
37
- client = ef .Client (USERNAME , PASSWORD ,
38
- "http://localhost:8080/" )
37
+ client = ef .Client (USERNAME , PASSWORD , "http://localhost:8080/" )
39
38
self .assertEqual (client .username , USERNAME )
40
39
self .assertEqual (client .password , PASSWORD )
41
40
self .assertEqual (client .root_url , "http://localhost:8080/" )
@@ -44,14 +43,12 @@ def test_client_creation(self):
44
43
45
44
def test_endpoint (self ):
46
45
"tests that endpoints are created correctly"
47
- client = ef .Client (USERNAME , PASSWORD ,
48
- "http://localhost:8080/" )
46
+ client = ef .Client (USERNAME , PASSWORD , "http://localhost:8080/" )
49
47
self .assertEqual (client .endpoint ("sessions" ),
50
48
"http://localhost:8080/sessions" )
51
49
52
50
def test_login (self ):
53
- client = ef .Client (USERNAME , PASSWORD ,
54
- "http://localhost:8080/" )
51
+ client = ef .Client (USERNAME , PASSWORD , "http://localhost:8080/" )
55
52
storage = []
56
53
requester = fake_post (storage , FakeResponse (200 ))
57
54
status , response = client .login (requester )
@@ -67,11 +64,10 @@ def test_login(self):
67
64
self .assertEqual (endpoint , "http://localhost:8080/sessions" )
68
65
69
66
def test_send_event (self ):
70
- client = ef .Client (USERNAME , PASSWORD ,
71
- "http://localhost:8080/" )
67
+ client = ef .Client (USERNAME , PASSWORD , "http://localhost:8080/" )
72
68
storage = []
73
69
requester = fake_post (storage , FakeResponse (201 ))
74
- data = {"name " : "bob" , "count " : 10 }
70
+ data = {"text " : "bob" , "percentage " : 10 }
75
71
channel = "my.channel"
76
72
event = ef .Event (data , channel )
77
73
status , response = client .send_event (event , requester )
@@ -80,7 +76,7 @@ def test_send_event(self):
80
76
data_arg = kwargs ["data" ]
81
77
headers = kwargs ["headers" ]
82
78
83
- self .assertTrue (status )
79
+ self .assertTrue (status )
84
80
self .assertEqual (response .status_code , 201 )
85
81
self .assertEqual (data_arg , json .dumps (event .json ["value" ]))
86
82
self .assertEqual (headers ["content-type" ], "application/json" )
0 commit comments