diff options
author | Tulio Casagrande <tcasagra@thoughtworks.com> | 2016-12-07 18:34:58 -0200 |
---|---|---|
committer | Tulio Casagrande <tcasagra@thoughtworks.com> | 2016-12-07 18:44:53 -0200 |
commit | 6f61691980fe11e2eb9c2b56b1acf16a2ceabce3 (patch) | |
tree | 5d4fd09abb4ca3676d0d74ab68d891af2d1b35fa /service/test/unit | |
parent | cef353491e5032d30f924b46dcae4e63897e189b (diff) |
[#801] Mocked event server on resource unit test
The resource unit test was breaking because the RootResource
initialize calls an event register (and the event queue is not
initialized on unit tests). We mocked the registering of events
so the unit tests don't try to touch the event queue at all.
Diffstat (limited to 'service/test/unit')
-rw-r--r-- | service/test/unit/resources/test_signup_resource.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/service/test/unit/resources/test_signup_resource.py b/service/test/unit/resources/test_signup_resource.py index 49a7ee41..2f2d2860 100644 --- a/service/test/unit/resources/test_signup_resource.py +++ b/service/test/unit/resources/test_signup_resource.py @@ -20,6 +20,7 @@ from twisted.trial import unittest from twisted.web.resource import getChildForRequest from twisted.web.test.requesthelper import DummyRequest +import leap.common.events from pixelated.application import get_static_folder from pixelated.resources.root_resource import RootResource from pixelated.resources.signup_resource import SignupResource @@ -27,6 +28,12 @@ from pixelated.resources.signup_resource import SignupResource class TestSignupResource(unittest.TestCase): + def setUp(self): + leap.common.events.register = MagicMock + + def tearDown(self): + reload(leap.common.events) + def test_get_resource_for_request(self): public_root_resource = RootResource(mock(), get_static_folder(), public=True) request = DummyRequest(['signup']) |