148
150
[activity] = view.interesting_activity
149
151
self.assertEqual("description", activity.whatchanged)
153
def test_error_for_changing_target_with_invalid_status(self):
154
# If a user moves a bug task with a restricted status (say,
155
# Triaged) to a target where they do not have permission to set
156
# that status, they will be unable to complete the retargeting
157
# and will instead receive an error in the UI.
158
person = self.factory.makePerson()
159
product = self.factory.makeProduct(
160
name='product1', owner=person, official_malone=True)
161
with person_logged_in(person):
162
product.setBugSupervisor(person, person)
163
product_2 = self.factory.makeProduct(
164
name='product2', official_malone=True)
165
with person_logged_in(product_2.owner):
166
product_2.setBugSupervisor(product_2.owner, product_2.owner)
167
bug = self.factory.makeBug(
168
product=product, owner=person)
169
# We need to commit here, otherwise all the sample data we
170
# created gets destroyed when the transaction is rolled back.
172
with person_logged_in(person):
174
'%s.product' % product.name: product_2.name,
175
'%s.status' % product.name: BugTaskStatus.TRIAGED.title,
176
'%s.actions.save' % product.name: 'Save Changes',
178
view = create_initialized_view(
179
bug.default_bugtask, name=u'+editstatus',
181
# The bugtask's target won't have changed, since an error
182
# happend. The error will be listed in the view.
183
self.assertEqual(1, len(view.errors))
184
self.assertEqual(product, bug.default_bugtask.target)
152
187
class TestBugTasksAndNominationsView(TestCaseWithFactory):