forked from mamachanko/import-lymph
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtests.py
More file actions
29 lines (22 loc) · 906 Bytes
/
Copy pathtests.py
File metadata and controls
29 lines (22 loc) · 906 Bytes
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
from lymph.testing import (LymphServiceTestCase, EventMockTestCase,
WebServiceTestCase, RpcMockTestCase)
from mock import call
from greeting import Greeting
from web import Web
class GreetingTest(LymphServiceTestCase, EventMockTestCase):
service_class = Greeting
service_name = u'Greeting'
def test_says_hi(self):
self.assertEqual(
self.client.proxy(u'Greeting').greet(name=u'John'),
u'Hi, John!'
)
self.assert_events_emitted(call(u'greeting', {u'name': u'John'}))
class WebTest(WebServiceTestCase, RpcMockTestCase):
service_class = Web
service_name = 'Web'
def test_post(self):
self.update_rpc_mock('Greeting.greet', 'Hi, John!')
response = self.client.post('/greet?name=John')
self.assertEqual(response.status_code, 200)
self.assertEqual(response.data, 'Hi, John!')