def test_highlighted_copyright_no_matches(self):
     expected = 'nothing to see and/or do.'
     remove_security_proxy_and_shout_at_engineer(
         self.source_package_release).copyright = expected
     view = create_initialized_view(
         self.source_package_release, '+copyright')
     self.assertEqual(expected, view.highlighted_copyright)
示例#2
0
 def test_highlighted_copyright_is_None(self):
     expected = ''
     remove_security_proxy_and_shout_at_engineer(
         self.source_package_release).copyright = None
     view = create_initialized_view(self.source_package_release,
                                    '+copyright')
     self.assertEqual(expected, view.highlighted_copyright)
示例#3
0
 def test_highlighted_copyright_no_matches(self):
     expected = 'nothing to see and/or do.'
     remove_security_proxy_and_shout_at_engineer(
         self.source_package_release).copyright = expected
     view = create_initialized_view(self.source_package_release,
                                    '+copyright')
     self.assertEqual(expected, view.highlighted_copyright)
 def test_highlighted_copyright_is_None(self):
     expected = ''
     remove_security_proxy_and_shout_at_engineer(
         self.source_package_release).copyright = None
     view = create_initialized_view(
         self.source_package_release, '+copyright')
     self.assertEqual(expected, view.highlighted_copyright)
 def test_setBranch(self):
     # setBranch sets the linked branch of the product series.
     product_series = self.factory.makeProductSeries()
     naked_product_series = remove_security_proxy_and_shout_at_engineer(
         product_series)
     branch = self.factory.makeProductBranch(product=product_series.product)
     ICanHasLinkedBranch(naked_product_series).setBranch(branch)
     self.assertEqual(branch, product_series.branch)
 def test_branch(self):
     # The linked branch of a product series is its branch attribute.
     product_series = self.factory.makeProductSeries()
     naked_product_series = remove_security_proxy_and_shout_at_engineer(
         product_series)
     naked_product_series.branch = self.factory.makeProductBranch(
         product=product_series.product)
     self.assertEqual(
         product_series.branch, ICanHasLinkedBranch(product_series).branch)
 def test_setBranch(self):
     # setBranch sets the linked branch of the product series.
     product_series = self.factory.makeProductSeries()
     naked_product_series = remove_security_proxy_and_shout_at_engineer(
         product_series)
     branch = self.factory.makeProductBranch(
         product=product_series.product)
     ICanHasLinkedBranch(naked_product_series).setBranch(branch)
     self.assertEqual(branch, product_series.branch)
 def test_branch(self):
     # The linked branch of a product series is its branch attribute.
     product_series = self.factory.makeProductSeries()
     naked_product_series = remove_security_proxy_and_shout_at_engineer(
         product_series)
     naked_product_series.branch = self.factory.makeProductBranch(
         product=product_series.product)
     self.assertEqual(product_series.branch,
                      ICanHasLinkedBranch(product_series).branch)
示例#9
0
 def test_highlighted_copyright_match_path(self):
     remove_security_proxy_and_shout_at_engineer(
         self.source_package_release).copyright = (
             'See /usr/share/common-licenses/GPL')
     expected = (
         'See '
         '<span class="highlight">/usr/share/common-licenses/GPL</span>')
     view = create_initialized_view(self.source_package_release,
                                    '+copyright')
     self.assertEqual(expected, view.highlighted_copyright)
 def test_highlighted_copyright_match_path(self):
     remove_security_proxy_and_shout_at_engineer(
         self.source_package_release).copyright = (
         'See /usr/share/common-licenses/GPL')
     expected = (
         'See '
         '<span class="highlight">/usr/share/common-licenses/GPL</span>')
     view = create_initialized_view(
         self.source_package_release, '+copyright')
     self.assertEqual(expected, view.highlighted_copyright)
 def test_product_series_link(self):
     # The link from a series branch's listing to the series goes to the
     # series on the main site, not the code site.
     branch = self.factory.makeProductBranch()
     series = self.factory.makeProductSeries(product=branch.product)
     series_name = series.name
     remove_security_proxy_and_shout_at_engineer(series).branch = branch
     browser = self.getUserBrowser(
         canonical_url(branch.product, rootsite='code'))
     link = browser.getLink(re.compile('^' + series_name + '$'))
     self.assertEqual('launchpad.dev', URI(link.url).host)
示例#12
0
 def test_highlighted_copyright_match_url(self):
     remove_security_proxy_and_shout_at_engineer(
         self.source_package_release).copyright = (
             'Downloaded from https://upstream.dom/fnord/no/ and')
     expected = (
         'Downloaded from '
         '<span class="highlight">https://upstream.dom/fnord/no/</span> '
         'and')
     view = create_initialized_view(self.source_package_release,
                                    '+copyright')
     self.assertEqual(expected, view.highlighted_copyright)
 def test_highlighted_copyright_match_url(self):
     remove_security_proxy_and_shout_at_engineer(
         self.source_package_release).copyright = (
         'Downloaded from https://upstream.dom/fnord/no/ and')
     expected = (
         'Downloaded from '
         '<span class="highlight">https://upstream.dom/fnord/no/</span> '
         'and')
     view = create_initialized_view(
         self.source_package_release, '+copyright')
     self.assertEqual(expected, view.highlighted_copyright)
 def test_product_series_link(self):
     # The link from a series branch's listing to the series goes to the
     # series on the main site, not the code site.
     branch = self.factory.makeProductBranch()
     series = self.factory.makeProductSeries(product=branch.product)
     series_name = series.name
     remove_security_proxy_and_shout_at_engineer(series).branch = branch
     browser = self.getUserBrowser(
         canonical_url(branch.product, rootsite='code'))
     link = browser.getLink(re.compile('^' + series_name + '$'))
     self.assertEqual('launchpad.dev', URI(link.url).host)
示例#15
0
 def setUp(self):
     super(TestDistroSourcePackageReleaseFiles, self).setUp()
     # The package must be published for the page to render.
     stp = SoyuzTestPublisher()
     distroseries = stp.setUpDefaultDistroSeries()
     naked_distroseries = remove_security_proxy_and_shout_at_engineer(
         distroseries)
     # XXX Abel Deuring, 2010-07-21, bug 608240. This is scary. But
     # if we use distroseries.distribution instead,
     # test_spr_files_deleted() and test_spr_files_one() fail.
     distro = naked_distroseries.distribution
     source_package_release = stp.getPubSource().sourcepackagerelease
     self.dspr = DistributionSourcePackageRelease(distro,
                                                  source_package_release)
     self.library_file = self.factory.makeLibraryFileAlias(
         filename='test_file.dsc', content='0123456789')
     source_package_release.addFile(self.library_file)
 def setUp(self):
     super(TestDistroSourcePackageReleaseFiles, self).setUp()
     # The package must be published for the page to render.
     stp = SoyuzTestPublisher()
     distroseries = stp.setUpDefaultDistroSeries()
     naked_distroseries = remove_security_proxy_and_shout_at_engineer(
         distroseries)
     # XXX Abel Deuring, 2010-07-21, bug 608240. This is scary. But
     # if we use distroseries.distribution instead,
     # test_spr_files_deleted() and test_spr_files_one() fail.
     distro = naked_distroseries.distribution
     source_package_release = stp.getPubSource().sourcepackagerelease
     self.dspr = DistributionSourcePackageRelease(
         distro, source_package_release)
     self.library_file = self.factory.makeLibraryFileAlias(
         filename='test_file.dsc', content='0123456789')
     source_package_release.addFile(self.library_file)
    def test_distroserieslanguage(self):
        distribution = self.factory.makeDistribution(
            name='crumb-tester', displayname="Crumb Tester")
        series = self.factory.makeDistroSeries(name="test",
                                               version="1.0",
                                               distribution=distribution)
        naked_series = remove_security_proxy_and_shout_at_engineer(series)
        naked_series.hide_all_translations = False
        serieslanguage = getUtility(IDistroSeriesLanguageSet).getDummy(
            series, self.language)

        self.assertBreadcrumbs(
            [("Crumb Tester", "http://launchpad.dev/crumb-tester"),
             ("Test (1.0)", "http://launchpad.dev/crumb-tester/test"),
             ("Translations",
              "http://translations.launchpad.dev/crumb-tester/test"),
             ("Serbian (sr)", "http://translations.launchpad.dev/"
              "crumb-tester/test/+lang/sr")], serieslanguage)
    def test_distroserieslanguage(self):
        distribution = self.factory.makeDistribution(
            name='crumb-tester', displayname="Crumb Tester")
        series = self.factory.makeDistroSeries(
            name="test", version="1.0", distribution=distribution)
        naked_series = remove_security_proxy_and_shout_at_engineer(series)
        naked_series.hide_all_translations = False
        serieslanguage = getUtility(IDistroSeriesLanguageSet).getDummy(
            series, self.language)

        self.assertBreadcrumbs(
            [("Crumb Tester", "http://launchpad.dev/crumb-tester"),
             ("Test (1.0)", "http://launchpad.dev/crumb-tester/test"),
             ("Translations",
              "http://translations.launchpad.dev/crumb-tester/test"),
             ("Serbian (sr)",
              "http://translations.launchpad.dev/"
              "crumb-tester/test/+lang/sr")],
            serieslanguage)
    def testSetupLocationForCOPY(self):
        """`PackageLocation` for COPY archives."""
        # First create a copy archive for the default Ubuntu primary
        ubuntu = self.getPackageLocation().distribution

        returned_location = self.factory.makeCopyArchiveLocation(
            distribution=ubuntu, name='now-comes-the-mystery',
            owner=self.factory.makePerson(name='mysteryman'))
        copy_archive = remove_security_proxy_and_shout_at_engineer(
            returned_location).archive

        # Now use the created copy archive to test the build_package_location
        # helper (called via getPackageLocation):
        location = self.getPackageLocation(purpose=ArchivePurpose.COPY,
                                           archive_name=copy_archive.name)

        self.assertEqual(location.distribution.name, 'ubuntu')
        self.assertEqual(location.distroseries.name, 'hoary')
        self.assertEqual(location.pocket.name, 'RELEASE')
        self.assertEqual(location.archive.displayname,
                         'Copy archive now-comes-the-mystery for Mysteryman')
        self.assertEqual([], location.packagesets)
示例#20
0
    def testSetupLocationForCOPY(self):
        """`PackageLocation` for COPY archives."""
        # First create a copy archive for the default Ubuntu primary
        ubuntu = self.getPackageLocation().distribution

        returned_location = self.factory.makeCopyArchiveLocation(
            distribution=ubuntu, name='now-comes-the-mystery',
            owner=self.factory.makePerson(name='mysteryman'))
        copy_archive = remove_security_proxy_and_shout_at_engineer(
            returned_location).archive

        # Now use the created copy archive to test the build_package_location
        # helper (called via getPackageLocation):
        location = self.getPackageLocation(purpose=ArchivePurpose.COPY,
                                           archive_name=copy_archive.name)

        self.assertEqual(location.distribution.name, 'ubuntu')
        self.assertEqual(location.distroseries.name, 'hoary')
        self.assertEqual(location.pocket.name, 'RELEASE')
        self.assertEqual(location.archive.displayname,
                         'Copy archive now-comes-the-mystery for Mysteryman')
        self.assertEqual([], location.packagesets)