summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorPatrick Maia <patrickjourdanmaia@gmail.com>2014-10-13 20:54:48 +0000
committerPatrick Maia <patrickjourdanmaia@gmail.com>2014-10-13 21:33:14 +0000
commit21eee8ccf485b8aca8d5677ba0f0de97fc0afc22 (patch)
treecaa64713ab0383e2fbb90fb259ff259764572ca3 /service
parent5e0e6fa9906d761d8fd6967ede5e755acf6f040d (diff)
#89 - removes some mock based tests (they are replaced by integration tests in a future commit)
Diffstat (limited to 'service')
-rw-r--r--service/test/unit/user_agent_test.py30
1 files changed, 2 insertions, 28 deletions
diff --git a/service/test/unit/user_agent_test.py b/service/test/unit/user_agent_test.py
index 83a35246..afc42bdd 100644
--- a/service/test/unit/user_agent_test.py
+++ b/service/test/unit/user_agent_test.py
@@ -49,22 +49,8 @@ class UserAgentTest(unittest.TestCase):
def tearDown(self):
unstub()
- def test_create_or_send_draft_should_create_draft_if_mail_has_no_ident(self):
- self.input_mail = self.draft()
-
- self.app.post('/mails', data='{}', content_type="application/json")
-
- verify(self.draft_service).create_draft(self.input_mail)
-
- def test_create_or_send_draft_should_send_draft_if_mail_has_ident(self):
- self.input_mail = self.draft()
-
- self.app.post('/mails', data='{"ident":1}', content_type="application/json")
-
- verify(self.mail_service).send(1, self.input_mail)
-
def test_sending_mail_return_sent_mail_data_when_send_succeeds(self):
- self.input_mail = self.draft()
+ self.input_mail = test_helper.input_mail()
when(self.mail_service).send(1, self.input_mail).thenReturn(self.input_mail)
self.input_mail.as_dict = lambda: {'header': {'from': 'a@a.a', 'to': 'b@b.b'},
'ident': 1,
@@ -79,7 +65,7 @@ class UserAgentTest(unittest.TestCase):
self.assertEqual(result.data, '{"status": [], "body": "email body", "ident": 1, "tags": [], "header": {"to": "b@b.b", "from": "a@a.a"}, "security_casing": {}}')
def test_sending_mail_return_error_message_when_send_fails(self):
- self.input_mail = self.draft()
+ self.input_mail = test_helper.input_mail()
def send_that_throws_exception(id, mail):
raise Exception('email sending failed', 'more information of error')
@@ -91,18 +77,6 @@ class UserAgentTest(unittest.TestCase):
self.assertEqual(result.status_code, 500)
self.assertEqual(result.data, '{"message": "email sending failed\\nmore information of error"}')
- def test_update_draft(self):
- self.input_mail = self.draft()
-
- when(self.draft_service).update_draft(1, self.input_mail).thenReturn(self.input_mail)
-
- self.app.put('/mails', data='{"ident":1}', content_type="application/json")
-
- verify(self.draft_service).update_draft(1, self.input_mail)
-
- def draft(self):
- return test_helper.input_mail()
-
def test_that_default_config_file_is_home_dot_pixelated(self):
orig_config = pixelated.user_agent.app.config
try: