~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/scripts/tests/test_garbo.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2012-01-05 21:38:46 UTC
  • mfrom: (14625.2.5 gina-dsc-binaries)
  • Revision ID: launchpad@pqm.canonical.com-20120105213846-8lb5f2ql18buf4gp
[r=allenap][bug=911943] Separate dsc_binaries correctly in gina,
        and add a garbo-daily job to clean up existing wreckage.

Show diffs side-by-side

added added

removed removed

Lines of Context:
996
996
        self.runDaily()
997
997
        self.assertEqual(0, unreferenced_msgsets.count())
998
998
 
 
999
    def test_SourcePackageReleaseDscBinariesUpdater_updates_incorrect(self):
 
1000
        # SourcePackageReleaseDscBinariesUpdater fixes incorrectly-separated
 
1001
        # dsc_binaries values.
 
1002
        LaunchpadZopelessLayer.switchDbUser('testadmin')
 
1003
        spr = self.factory.makeSourcePackageRelease(
 
1004
            dsc_binaries="one two three")
 
1005
        transaction.commit()
 
1006
        self.runDaily()
 
1007
        self.assertEqual("one, two, three", spr.dsc_binaries)
 
1008
 
 
1009
    def test_SourcePackageReleaseDscBinariesUpdater_skips_correct(self):
 
1010
        # SourcePackageReleaseDscBinariesUpdater leaves correct dsc_binaries
 
1011
        # values alone.
 
1012
        LaunchpadZopelessLayer.switchDbUser('testadmin')
 
1013
        spr_one = self.factory.makeSourcePackageRelease(dsc_binaries="one")
 
1014
        spr_three = self.factory.makeSourcePackageRelease(
 
1015
            dsc_binaries="one, two, three")
 
1016
        transaction.commit()
 
1017
        self.runDaily()
 
1018
        self.assertEqual("one", spr_one.dsc_binaries)
 
1019
        self.assertEqual("one, two, three", spr_three.dsc_binaries)
 
1020
 
 
1021
    def test_SourcePackageReleaseDscBinariesUpdater_skips_broken(self):
 
1022
        # There have been a few instances of Binary fields in PPA packages
 
1023
        # that are formatted like a dependency relationship field, complete
 
1024
        # with (>= ...).  This is completely invalid (and failed to build),
 
1025
        # but does exist historically, so we have to deal with it.
 
1026
        # SourcePackageReleaseDscBinariesUpdater leaves such fields well
 
1027
        # alone.
 
1028
        LaunchpadZopelessLayer.switchDbUser('testadmin')
 
1029
        spr = self.factory.makeSourcePackageRelease(
 
1030
            dsc_binaries="one (>= 1), two")
 
1031
        transaction.commit()
 
1032
        self.runDaily()
 
1033
        self.assertEqual("one (>= 1), two", spr.dsc_binaries)
 
1034
 
999
1035
 
1000
1036
class TestGarboTasks(TestCaseWithFactory):
1001
1037
    layer = LaunchpadZopelessLayer