Skip to content

Commit

Permalink
Annotate zerver/tests/test_email_mirror.py.
Browse files Browse the repository at this point in the history
  • Loading branch information
sharmaeklavya2 authored and timabbott committed Oct 11, 2016
1 parent b741c73 commit f7092b1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
1 change: 0 additions & 1 deletion tools/run-mypy
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ bots/zephyr_mirror_backend.py
tools/deprecated/generate-activity-metrics.py
zproject/settings.py
zproject/test_settings.py
zerver/tests/test_email_mirror.py
zerver/tests/test_decorators.py
zerver/tests/test_upload.py
zerver/tests/test_narrow.py
Expand Down
18 changes: 10 additions & 8 deletions zerver/tests/test_email_mirror.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def test_receive_stream_email_messages_success(self):

stream_to_address = encode_email_address(stream)

incoming_valid_message = MIMEText('TestStreamEmailMessages Body')
incoming_valid_message = MIMEText('TestStreamEmailMessages Body') # type: Any # https://github.com/python/typeshed/issues/275

incoming_valid_message['Subject'] = 'TestStreamEmailMessages Subject'
incoming_valid_message['From'] = "[email protected]"
Expand Down Expand Up @@ -119,15 +119,15 @@ def test_receive_stream_email_messages_empty_body(self):
headers['Reply-To'] = '[email protected]'

# empty body
incoming_valid_message = MIMEText('')
incoming_valid_message = MIMEText('') # type: Any # https://github.com/python/typeshed/issues/275

incoming_valid_message['Subject'] = 'TestStreamEmailMessages Subject'
incoming_valid_message['From'] = "[email protected]"
incoming_valid_message['To'] = stream_to_address
incoming_valid_message['Reply-to'] = "[email protected]"

exception_message = ""
debug_info = {}
debug_info = {} # type: Dict[str, Any]

# process_message eats the exception & logs an error which can't be parsed here
# so calling process_stream_message directly
Expand Down Expand Up @@ -162,7 +162,7 @@ def test_receive_missed_personal_message_email_messages(self):
# token for looking up who did reply.
mm_address = create_missed_message_address(user_profile, usermessage.message)

incoming_valid_message = MIMEText('TestMissedMessageEmailMessages Body')
incoming_valid_message = MIMEText('TestMissedMessageEmailMessages Body') # type: Any # https://github.com/python/typeshed/issues/275

incoming_valid_message['Subject'] = 'TestMissedMessageEmailMessages Subject'
incoming_valid_message['From'] = "[email protected]"
Expand Down Expand Up @@ -203,7 +203,7 @@ def test_receive_missed_huddle_message_email_messages(self):
# token for looking up who did reply.
mm_address = create_missed_message_address(user_profile, usermessage.message)

incoming_valid_message = MIMEText('TestMissedHuddleMessageEmailMessages Body')
incoming_valid_message = MIMEText('TestMissedHuddleMessageEmailMessages Body') # type: Any # https://github.com/python/typeshed/issues/275

incoming_valid_message['Subject'] = 'TestMissedHuddleMessageEmailMessages Subject'
incoming_valid_message['From'] = "[email protected]"
Expand Down Expand Up @@ -250,6 +250,7 @@ class TestDigestEmailMessages(ZulipTestCase):
@mock.patch('zerver.lib.digest.enough_traffic')
@mock.patch('zerver.lib.digest.send_future_email')
def test_receive_digest_email_messages(self, mock_send_future_email, mock_enough_traffic):
# type: (mock.MagicMock, mock.MagicMock) -> None

# build dummy messages for missed messages email reply
# have Hamlet send Othello a PM. Othello will reply via email
Expand All @@ -262,7 +263,8 @@ def test_receive_digest_email_messages(self, mock_send_future_email, mock_enough
self.assert_json_success(result)

user_profile = get_user_profile_by_email("[email protected]")
cutoff = time.mktime(datetime.datetime(year=2016, month=1, day=1).timetuple())
cutoff = time.mktime(datetime.datetime(year=2016, month=1, day=1).timetuple()) # type: ignore # https://github.com/python/typeshed/pull/597

handle_digest_email(user_profile.id, cutoff)
self.assertEqual(mock_send_future_email.call_count, 1)
self.assertEqual(mock_send_future_email.call_args[0][0][0]['email'],
Expand All @@ -286,7 +288,7 @@ def test_reply_is_extracted_from_plain(self):
Quote"""

incoming_valid_message = MIMEText(text)
incoming_valid_message = MIMEText(text) # type: Any # https://github.com/python/typeshed/issues/275

incoming_valid_message['Subject'] = 'TestStreamEmailMessages Subject'
incoming_valid_message['From'] = "[email protected]"
Expand Down Expand Up @@ -330,7 +332,7 @@ def test_reply_is_extracted_from_html(self):
</html>
"""

incoming_valid_message = MIMEText(html, 'html')
incoming_valid_message = MIMEText(html, 'html') # type: Any # https://github.com/python/typeshed/issues/275

incoming_valid_message['Subject'] = 'TestStreamEmailMessages Subject'
incoming_valid_message['From'] = "[email protected]"
Expand Down

0 comments on commit f7092b1

Please sign in to comment.