~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/bugs/model/tests/test_bugsummary.py

  • Committer: Stuart Bishop
  • Date: 2011-05-31 15:42:53 UTC
  • mto: (7675.1045.464 db-devel)
  • mto: This revision was merged to the branch mainline in revision 13163.
  • Revision ID: stuart.bishop@canonical.com-20110531154253-e92wguo2j0npchvc
DistroSeriesSourcePackage tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
679
679
            0)
680
680
 
681
681
    def test_addDistroSeriesSourcePackage(self):
682
 
        raise NotImplementedError
 
682
        distribution = self.factory.makeDistribution()
 
683
        series = self.factory.makeDistroRelease(distribution=distribution)
 
684
        package = self.factory.makeSourcePackage(distroseries=series)
 
685
        sourcepackagename = package.sourcepackagename
 
686
        bug_task = self.factory.makeBugTask(target=package)
 
687
 
 
688
        self.assertEqual(
 
689
            self.getPublicCount(
 
690
                BugSummary.distribution == distribution,
 
691
                BugSummary.sourcepackagename == None),
 
692
            1)
 
693
        self.assertEqual(
 
694
            self.getPublicCount(
 
695
                BugSummary.distribution == distribution,
 
696
                BugSummary.sourcepackagename == sourcepackagename),
 
697
            1)
 
698
        self.assertEqual(
 
699
            self.getPublicCount(
 
700
                BugSummary.distroseries == series,
 
701
                BugSummary.sourcepackagename == None),
 
702
            1)
 
703
        self.assertEqual(
 
704
            self.getPublicCount(
 
705
                BugSummary.distroseries == series,
 
706
                BugSummary.sourcepackagename == sourcepackagename),
 
707
            1)
683
708
 
684
709
    def test_changeDistroSeriesSourcePackage(self):
685
 
        raise NotImplementedError
 
710
        distribution = self.factory.makeDistribution()
 
711
        series = self.factory.makeDistroRelease(distribution=distribution)
 
712
        package_a = self.factory.makeSourcePackage(distroseries=series)
 
713
        package_b = self.factory.makeSourcePackage(distroseries=series)
 
714
        sourcepackagename_a = package_a.sourcepackagename
 
715
        sourcepackagename_b = package_b.sourcepackagename
 
716
        bug_task = self.factory.makeBugTask(target=package_a)
 
717
 
 
718
        self.assertEqual(
 
719
            self.getPublicCount(
 
720
                BugSummary.distribution == distribution,
 
721
                BugSummary.sourcepackagename == None),
 
722
            1)
 
723
        self.assertEqual(
 
724
            self.getPublicCount(
 
725
                BugSummary.distribution == distribution,
 
726
                BugSummary.sourcepackagename == sourcepackagename_a),
 
727
            1)
 
728
        self.assertEqual(
 
729
            self.getPublicCount(
 
730
                BugSummary.distribution == distribution,
 
731
                BugSummary.sourcepackagename == sourcepackagename_b),
 
732
            0)
 
733
        self.assertEqual(
 
734
            self.getPublicCount(
 
735
                BugSummary.distroseries == series,
 
736
                BugSummary.sourcepackagename == None),
 
737
            1)
 
738
        self.assertEqual(
 
739
            self.getPublicCount(
 
740
                BugSummary.distroseries == series,
 
741
                BugSummary.sourcepackagename == sourcepackagename_a),
 
742
            1)
 
743
        self.assertEqual(
 
744
            self.getPublicCount(
 
745
                BugSummary.distroseries == series,
 
746
                BugSummary.sourcepackagename == sourcepackagename_b),
 
747
            0)
 
748
 
 
749
        bug_task.sourcepackagename = sourcepackagename_b
 
750
 
 
751
        self.assertEqual(
 
752
            self.getPublicCount(
 
753
                BugSummary.distribution == distribution,
 
754
                BugSummary.sourcepackagename == None),
 
755
            1)
 
756
        self.assertEqual(
 
757
            self.getPublicCount(
 
758
                BugSummary.distribution == distribution,
 
759
                BugSummary.sourcepackagename == sourcepackagename_a),
 
760
            0)
 
761
        self.assertEqual(
 
762
            self.getPublicCount(
 
763
                BugSummary.distribution == distribution,
 
764
                BugSummary.sourcepackagename == sourcepackagename_b),
 
765
            1)
 
766
        self.assertEqual(
 
767
            self.getPublicCount(
 
768
                BugSummary.distroseries == series,
 
769
                BugSummary.sourcepackagename == None),
 
770
            1)
 
771
        self.assertEqual(
 
772
            self.getPublicCount(
 
773
                BugSummary.distroseries == series,
 
774
                BugSummary.sourcepackagename == sourcepackagename_a),
 
775
            0)
 
776
        self.assertEqual(
 
777
            self.getPublicCount(
 
778
                BugSummary.distroseries == series,
 
779
                BugSummary.sourcepackagename == sourcepackagename_b),
 
780
            1)
686
781
 
687
782
    def test_removeDistroSeriesSourcePackage(self):
688
 
        raise NotImplementedError
 
783
        distribution = self.factory.makeDistribution()
 
784
        series = self.factory.makeDistroRelease(distribution=distribution)
 
785
        package = self.factory.makeSourcePackage(distroseries=series)
 
786
        sourcepackagename = package.sourcepackagename
 
787
        bug_task = self.factory.makeBugTask(target=package)
 
788
 
 
789
        self.assertEqual(
 
790
            self.getPublicCount(
 
791
                BugSummary.distribution == distribution,
 
792
                BugSummary.sourcepackagename == None),
 
793
            1)
 
794
        self.assertEqual(
 
795
            self.getPublicCount(
 
796
                BugSummary.distribution == distribution,
 
797
                BugSummary.sourcepackagename == sourcepackagename),
 
798
            1)
 
799
        self.assertEqual(
 
800
            self.getPublicCount(
 
801
                BugSummary.distroseries == series,
 
802
                BugSummary.sourcepackagename == None),
 
803
            1)
 
804
        self.assertEqual(
 
805
            self.getPublicCount(
 
806
                BugSummary.distroseries == series,
 
807
                BugSummary.sourcepackagename == sourcepackagename),
 
808
            1)
 
809
 
 
810
        bug_task.sourcepackagename = None
 
811
 
 
812
        self.assertEqual(
 
813
            self.getPublicCount(
 
814
                BugSummary.distribution == distribution,
 
815
                BugSummary.sourcepackagename == None),
 
816
            1)
 
817
        self.assertEqual(
 
818
            self.getPublicCount(
 
819
                BugSummary.distribution == distribution,
 
820
                BugSummary.sourcepackagename == sourcepackagename),
 
821
            0)
 
822
        self.assertEqual(
 
823
            self.getPublicCount(
 
824
                BugSummary.distroseries == series,
 
825
                BugSummary.sourcepackagename == None),
 
826
            1)
 
827
        self.assertEqual(
 
828
            self.getPublicCount(
 
829
                BugSummary.distroseries == series,
 
830
                BugSummary.sourcepackagename == sourcepackagename),
 
831
            0)
689
832
 
690
833
    def test_addMilestone(self):
691
834
        raise NotImplemetnedError