~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-08-22 13:32:36 UTC
  • mfrom: (13746.2.12 bug-830849)
  • Revision ID: launchpad@pqm.canonical.com-20110822133236-i7jmz8jat8ck2ee8
[r=henninge][bug=830849] Merge validate_target_attribute and
 validate_sourcepackagename into BugTask.transitionToTarget.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1910
1910
            new_product.bugtargetdisplayname,
1911
1911
            removeSecurityProxy(task).targetnamecache)
1912
1912
 
 
1913
    def test_matching_sourcepackage_tasks_updated_when_name_changed(self):
 
1914
        # If the sourcepackagename is changed, it's changed on all tasks
 
1915
        # with the same distribution and sourcepackagename.
 
1916
 
 
1917
        # Create a distribution and distroseries with tasks.
 
1918
        ds = self.factory.makeDistroSeries()
 
1919
        bug = self.factory.makeBug(distribution=ds.distribution)
 
1920
        ds_task = self.factory.makeBugTask(bug=bug, target=ds)
 
1921
 
 
1922
        # Also create a task for another distro. It will not be touched.
 
1923
        other_distro = self.factory.makeDistribution()
 
1924
        self.factory.makeBugTask(bug=bug, target=other_distro)
 
1925
 
 
1926
        self.assertContentEqual(
 
1927
            (task.target for task in bug.bugtasks),
 
1928
            [ds, ds.distribution, other_distro])
 
1929
        sp = self.factory.makeSourcePackage(distroseries=ds, publish=True)
 
1930
        with person_logged_in(ds_task.owner):
 
1931
            ds_task.transitionToTarget(sp)
 
1932
        self.assertContentEqual(
 
1933
            (t.target for t in bug.bugtasks),
 
1934
            [sp, sp.distribution_sourcepackage, other_distro])
 
1935
 
1913
1936
 
1914
1937
class TestBugTargetKeys(TestCaseWithFactory):
1915
1938
    """Tests for bug_target_to_key and bug_target_from_key."""