+ def testUnArchivingPatches(self):
+ # Start with one patch archived and the remaining ones unarchived.
+ self.patches[0].archived = True
+ self.patches[0].save()
+ data = self.base_data.copy()
+ data.update({'archived': 'False'})
+ self._selectAllPatches(data)
+ response = self.client.post(self.url, data)
+ self.assertContains(response, self.properties_form_id,
+ status_code = 200)
+ for patch in [Patch.objects.get(pk = p.pk) for p in self.patches]:
+ self.assertFalse(patch.archived)
+
+ def _testStateChange(self, state):
+ data = self.base_data.copy()
+ data.update({'state': str(state)})
+ self._selectAllPatches(data)
+ response = self.client.post(self.url, data)
+ self.assertContains(response, self.properties_form_id,
+ status_code = 200)
+ return response
+
+ def testStateChangeValid(self):
+ states = [patch.state.pk for patch in self.patches]
+ state = State.objects.exclude(pk__in = states)[0]
+ self._testStateChange(state.pk)