def generate_fixture_output_file(self): self.output_file = OutputFile(comment="", revision=1, task_id=self.task.id, entity_id=self.entity.id, person_id=self.person.id, file_status_id=self.file_status.id) self.output_file.save()
def test_get_next_revision_with_empty_revision(self): output_file = OutputFile( name="test", task_id=self.task.id, entity_id=self.entity.id, file_status_id=self.file_status.id ) output_file.save() result = self.get( "project/tasks/%s/output_files/next-revision" % self.task.id ) self.assertEqual(result["next_revision"], 2)
def create_new_output_revision(entity_id, task_id, person_id, comment, revision=0): try: output_file = get_last_output_revision(task_id, entity_id) revision = output_file.revision + 1 except NoOutputFileException: revision = 1 file_status_id = get_default_status().id output_file = OutputFile(comment=comment, revision=revision, task_id=task_id, entity_id=entity_id, person_id=person_id, file_status_id=file_status_id) output_file.save() return output_file