1910
1910
new_product.bugtargetdisplayname,
1911
1911
removeSecurityProxy(task).targetnamecache)
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.
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)
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)
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])
1914
1937
class TestBugTargetKeys(TestCaseWithFactory):
1915
1938
"""Tests for bug_target_to_key and bug_target_from_key."""