← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:py3-assertContentEqual into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:py3-assertContentEqual into launchpad:master.

Commit message:
Use assertContentEqual for some unorderable types

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/398629

Neither `Person` nor `EmailAddress` is orderable, and in any case the assertion in `TestPersonEmailSecurity.test_logged_in_can_access` was vacuous because it was asserting that a list wasn't equal to an integer.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-assertContentEqual into launchpad:master.
diff --git a/lib/lp/registry/browser/tests/test_person_webservice.py b/lib/lp/registry/browser/tests/test_person_webservice.py
index 07685fb..a4b8150 100644
--- a/lib/lp/registry/browser/tests/test_person_webservice.py
+++ b/lib/lp/registry/browser/tests/test_person_webservice.py
@@ -64,10 +64,9 @@ class TestPersonEmailSecurity(TestCaseWithFactory):
         accessor = self.factory.makePerson()
         lp = launchpadlib_for("test", accessor.name)
         person = lp.people['target']
-        emails = sorted(list(person.confirmed_email_addresses))
-        self.assertNotEqual(
-                sorted([self.email_one, self.email_two]),
-                len(emails))
+        emails = [entry.email for entry in person.confirmed_email_addresses]
+        self.assertContentEqual(
+            ['test1@xxxxxxxxxxx', 'test2@xxxxxxxxxxx'], emails)
 
     def test_anonymous_cannot_access(self):
         # An anonymous launchpadlib connection cannot see email addresses.
diff --git a/lib/lp/soyuz/mail/tests/test_packageupload.py b/lib/lp/soyuz/mail/tests/test_packageupload.py
index d39d9c3..3e9c0b1 100644
--- a/lib/lp/soyuz/mail/tests/test_packageupload.py
+++ b/lib/lp/soyuz/mail/tests/test_packageupload.py
@@ -12,7 +12,6 @@ from testtools.matchers import (
     Contains,
     ContainsDict,
     Equals,
-    KeysEqual,
     )
 from zope.component import getUtility
 from zope.security.proxy import removeSecurityProxy
@@ -404,7 +403,7 @@ class TestNotification(TestCaseWithFactory):
         observed, _ = PackageUploadMailer.getRecipientsForAction(
             'accepted', info, blamer, None, [], archive, distroseries,
             PackagePublishingPocket.RELEASE)
-        self.assertThat(observed, KeysEqual(*expected))
+        self.assertContentEqual(expected, observed.keys())
 
     def test_getRecipientsForAction_good_emails(self):
         # Test getRecipientsForAction with good email addresses..