API - fix tests w/ python 3.7

This commit is contained in:
Sam 2020-05-21 16:31:52 +02:00
parent 736a1f910a
commit b351f3d42c

View File

@ -39,9 +39,16 @@ class TestEmailSending:
} }
@staticmethod @staticmethod
def assert_smtp(smtp): def get_args(call_args):
if len(call_args) == 2:
args, _ = call_args
else:
_, args, _ = call_args
return args
def assert_smtp(self, smtp):
assert smtp.sendmail.call_count == 1 assert smtp.sendmail.call_count == 1
call_args = smtp.sendmail.call_args.args call_args = self.get_args(smtp.sendmail.call_args)
assert call_args[0] == 'fittrackee@example.com' assert call_args[0] == 'fittrackee@example.com'
assert call_args[1] == 'test@test.com' assert call_args[1] == 'test@test.com'
assert expected_en_text_body in call_args[2] assert expected_en_text_body in call_args[2]