diff options
author | Folker Bernitt <fbernitt@thoughtworks.com> | 2016-01-04 11:46:23 +0100 |
---|---|---|
committer | Folker Bernitt <fbernitt@thoughtworks.com> | 2016-01-04 11:46:23 +0100 |
commit | 7901cb59a5924f8b21462d4f58332fced842c91a (patch) | |
tree | f927d44931d8dc283abab798149d216afd247930 /service/test | |
parent | e0d2aaee3c8ed964698e092a4aa43e830fbf8288 (diff) |
Decouple test_feedback_service from dev provider
- Mock request instead
Diffstat (limited to 'service/test')
-rw-r--r-- | service/test/integration/test_feedback_service.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/service/test/integration/test_feedback_service.py b/service/test/integration/test_feedback_service.py index dd32374e..c50c1883 100644 --- a/service/test/integration/test_feedback_service.py +++ b/service/test/integration/test_feedback_service.py @@ -1,16 +1,23 @@ -import os import unittest +from httmock import urlmatch, HTTMock from mockito import when from twisted.internet import defer from test.support.integration import AppTestClient +@urlmatch(netloc=r'some.leap-provider.tld$') +def google_mock(url, request): + return 'Pixelated is awesome!' + + class TestFeedbackService(unittest.TestCase, AppTestClient): + @defer.inlineCallbacks def test_open_ticket(self): - yield self.start_client() - self.feedback_service.FEEDBACK_URL = "https://dev.pixelated-project.org/tickets" - when(self.leap_session).account_email().thenReturn("text@pixelated-project.org") - response = self.feedback_service.open_ticket("Pixelated is awesome!") + with HTTMock(google_mock): + yield self.start_client() + self.feedback_service.FEEDBACK_URL = "https://some.leap-provider.tld/tickets" + when(self.leap_session).account_email().thenReturn("text@pixelated-project.org") + response = self.feedback_service.open_ticket("Pixelated is awesome!") - self.assertEquals(response.status_code, 200) + self.assertEquals(response.status_code, 200) |