def test_getBinaryPackageDescriptions_strips_newlines(self):
     name = self.factory.makeBinaryPackageName()
     self.factory.makeBinaryPackageRelease(binarypackagename=name,
                                           description="f\no")
     self.assertEqual({name.name: "f o"},
                      getBinaryPackageDescriptions([name],
                                                   max_title_length=3))
 def test_getBinaryPackageDescriptions_strips_newlines(self):
     name = self.factory.makeBinaryPackageName()
     self.factory.makeBinaryPackageRelease(
         binarypackagename=name, description="f\no")
     self.assertEqual(
         {name.name: "f o"},
         getBinaryPackageDescriptions([name], max_title_length=3))
 def test_getBinaryPackageDescriptions_use_names(self):
     name = self.factory.makeBinaryPackageName()
     self.factory.makeBinaryPackageRelease(
         binarypackagename=name, description="foo")
     self.assertEqual(
         {name.name: "foo"},
         getBinaryPackageDescriptions(
             [name], use_names=True, max_title_length=3))
 def test_getBinaryPackageDescriptions_use_names(self):
     name = self.factory.makeBinaryPackageName()
     self.factory.makeBinaryPackageRelease(binarypackagename=name,
                                           description="foo")
     self.assertEqual({name.name: "foo"},
                      getBinaryPackageDescriptions([name],
                                                   use_names=True,
                                                   max_title_length=3))
 def test_getBinaryPackageDescriptions_two_packages(self):
     name1 = self.factory.makeBinaryPackageName()
     name2 = self.factory.makeBinaryPackageName()
     self.factory.makeBinaryPackageRelease(
         binarypackagename=name1, description="foo")
     self.factory.makeBinaryPackageRelease(
         binarypackagename=name2, description="bar")
     self.assertEqual(
         {name1.name: "foo", name2.name: "bar"},
         getBinaryPackageDescriptions([name1, name2], max_title_length=3))
 def test_getBinaryPackageDescriptions_two_packages(self):
     name1 = self.factory.makeBinaryPackageName()
     name2 = self.factory.makeBinaryPackageName()
     self.factory.makeBinaryPackageRelease(binarypackagename=name1,
                                           description="foo")
     self.factory.makeBinaryPackageRelease(binarypackagename=name2,
                                           description="bar")
     self.assertEqual({
         name1.name: "foo",
         name2.name: "bar"
     }, getBinaryPackageDescriptions([name1, name2], max_title_length=3))
 def test_getBinaryPackageDescriptions_no_release(self):
     name = self.factory.makeBinaryPackageName()
     self.assertEqual({}, getBinaryPackageDescriptions([name]))
 def test_getBinaryPackageDescriptions_none(self):
     self.assertEqual({}, getBinaryPackageDescriptions([]))
            binarypackagename=name, description="foot")
        self.assertEqual(
            {name.name: "foo..."},
            getBinaryPackageDescriptions([name], max_title_length=3))

    def test_getBinaryPackageDescriptions_uses_latest(self):
        name = self.factory.makeBinaryPackageName()
        self.factory.makeBinaryPackageRelease(
            binarypackagename=name, description="foo",
            date_created=datetime(1980, 01, 01, tzinfo=pytz.UTC))
        self.factory.makeBinaryPackageRelease(
            binarypackagename=name, description="bar",
            date_created=datetime(2000, 01, 01, tzinfo=pytz.UTC))
        self.assertEqual(
            {name.name: "bar"},
            getBinaryPackageDescriptions([name], max_title_length=3))

    def test_getBinaryPackageDescriptions_two_packages(self):
        name1 = self.factory.makeBinaryPackageName()
        name2 = self.factory.makeBinaryPackageName()
        self.factory.makeBinaryPackageRelease(
            binarypackagename=name1, description="foo")
        self.factory.makeBinaryPackageRelease(
            binarypackagename=name2, description="bar")
        self.assertEqual(
            {name1.name: "foo", name2.name: "bar"},
            getBinaryPackageDescriptions([name1, name2], max_title_length=3))

    def test_getBinaryPackageDescriptions_strips_newlines(self):
        name = self.factory.makeBinaryPackageName()
        self.factory.makeBinaryPackageRelease(
 def test_getBinaryPackageDescriptions_no_release(self):
     name = self.factory.makeBinaryPackageName()
     self.assertEqual({}, getBinaryPackageDescriptions([name]))
 def test_getBinaryPackageDescriptions_none(self):
     self.assertEqual({}, getBinaryPackageDescriptions([]))
        self.factory.makeBinaryPackageRelease(binarypackagename=name,
                                              description="foo",
                                              date_created=datetime(
                                                  1980,
                                                  01,
                                                  01,
                                                  tzinfo=pytz.UTC))
        self.factory.makeBinaryPackageRelease(binarypackagename=name,
                                              description="bar",
                                              date_created=datetime(
                                                  2000,
                                                  01,
                                                  01,
                                                  tzinfo=pytz.UTC))
        self.assertEqual({name.name: "bar"},
                         getBinaryPackageDescriptions([name],
                                                      max_title_length=3))

    def test_getBinaryPackageDescriptions_two_packages(self):
        name1 = self.factory.makeBinaryPackageName()
        name2 = self.factory.makeBinaryPackageName()
        self.factory.makeBinaryPackageRelease(binarypackagename=name1,
                                              description="foo")
        self.factory.makeBinaryPackageRelease(binarypackagename=name2,
                                              description="bar")
        self.assertEqual({
            name1.name: "foo",
            name2.name: "bar"
        }, getBinaryPackageDescriptions([name1, name2], max_title_length=3))

    def test_getBinaryPackageDescriptions_strips_newlines(self):
        name = self.factory.makeBinaryPackageName()