95
95
def test_new_harry_not_linked(self):
96
96
# Check a NEW email address is not used to link.
97
harry = self._makeHarry(EmailAddressStatus.NEW)
97
self._makeHarry(EmailAddressStatus.NEW)
98
98
author = self._createRevisionAuthor()
99
99
self.assertEqual('harry@canonical.com', author.email)
100
100
self.assertEqual(None, author.person)
147
147
def test_validated_email_updates(self):
148
148
# A newly validated email for a user.
149
self.assertEqual(None, self.author.person,
150
'No author should be initially set.')
150
None, self.author.person, "No author should be initially set.")
151
151
harry = self._makeHarry(EmailAddressStatus.NEW)
152
152
# Since the email address is initially new, there should still be
154
self.assertEqual(None, self.author.person,
155
'No author should be set yet.')
155
None, self.author.person, "No author should be set yet.")
156
156
email = harry.guessedemails[0]
157
157
harry.validateAndEnsurePreferredEmail(email)
158
transaction.commit() # Sync all changes
158
transaction.commit() # Sync changes.
160
160
# The link still hasn't been created at this point.
161
self.assertEqual(None, self.author.person,
162
'No author should be set yet.')
162
None, self.author.person, "No author should be set yet.")
164
164
# After the garbo RevisionAuthorEmailLinker job runs, the link
166
166
RevisionAuthorEmailLinker(log=DevNullLogger()).run()
167
self.assertEqual(harry, self.author.person,
168
'Harry should now be the author.')
168
harry, self.author.person, "Harry should now be the author.")
171
171
class TestRevisionAuthor(TestCase):