~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

  • Committer: Colin Watson
  • Date: 2012-01-05 17:17:19 UTC
  • mto: This revision was merged to the branch mainline in revision 14643.
  • Revision ID: cjwatson@canonical.com-20120105171719-1sff2v1of050d4nr
Simplify test as suggested by Gavin Panella.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1030
1030
        # SourcePackageReleaseDscBinariesUpdater fixes incorrectly-separated
1031
1031
        # dsc_binaries values.
1032
1032
        LaunchpadZopelessLayer.switchDbUser('testadmin')
1033
 
        three = [
1034
 
            self.factory.getUniqueString(),
1035
 
            self.factory.getUniqueString(),
1036
 
            self.factory.getUniqueString(),
1037
 
            ]
1038
 
        spr_three = self.factory.makeSourcePackageRelease(
1039
 
            dsc_binaries=" ".join(three))
 
1033
        spr = self.factory.makeSourcePackageRelease(
 
1034
            dsc_binaries="one two three")
1040
1035
        transaction.commit()
1041
1036
        self.runDaily()
1042
 
        self.assertEqual(", ".join(three), spr_three.dsc_binaries)
 
1037
        self.assertEqual("one, two, three", spr.dsc_binaries)
1043
1038
 
1044
1039
    def test_SourcePackageReleaseDscBinariesUpdater_skips_correct(self):
1045
1040
        # SourcePackageReleaseDscBinariesUpdater leaves correct dsc_binaries
1046
1041
        # values alone.
1047
1042
        LaunchpadZopelessLayer.switchDbUser('testadmin')
1048
 
        one = self.factory.getUniqueString()
1049
 
        spr_one = self.factory.makeSourcePackageRelease(dsc_binaries=one)
1050
 
        three = ", ".join([
1051
 
            self.factory.getUniqueString(),
1052
 
            self.factory.getUniqueString(),
1053
 
            self.factory.getUniqueString(),
1054
 
            ])
1055
 
        spr_three = self.factory.makeSourcePackageRelease(dsc_binaries=three)
 
1043
        spr_one = self.factory.makeSourcePackageRelease(dsc_binaries="one")
 
1044
        spr_three = self.factory.makeSourcePackageRelease(
 
1045
            dsc_binaries="one, two, three")
1056
1046
        transaction.commit()
1057
1047
        self.runDaily()
1058
 
        self.assertEqual(one, spr_one.dsc_binaries)
1059
 
        self.assertEqual(three, spr_three.dsc_binaries)
 
1048
        self.assertEqual("one", spr_one.dsc_binaries)
 
1049
        self.assertEqual("one, two, three", spr_three.dsc_binaries)
1060
1050
 
1061
1051
    def test_SourcePackageReleaseDscBinariesUpdater_skips_broken(self):
1062
1052
        # There have been a few instances of Binary fields in PPA packages
1066
1056
        # SourcePackageReleaseDscBinariesUpdater leaves such fields well
1067
1057
        # alone.
1068
1058
        LaunchpadZopelessLayer.switchDbUser('testadmin')
1069
 
        broken = "%s (>= 1), %s" % (
1070
 
            self.factory.getUniqueString(), self.factory.getUniqueString())
1071
 
        spr_broken = self.factory.makeSourcePackageRelease(
1072
 
            dsc_binaries=broken)
 
1059
        spr = self.factory.makeSourcePackageRelease(
 
1060
            dsc_binaries="one (>= 1), two")
1073
1061
        transaction.commit()
1074
1062
        self.runDaily()
1075
 
        self.assertEqual(broken, spr_broken.dsc_binaries)
 
1063
        self.assertEqual("one (>= 1), two", spr.dsc_binaries)
1076
1064
 
1077
1065
 
1078
1066
class TestGarboTasks(TestCaseWithFactory):