Example #1
0
 def setUp(self):
     super().setUp()
     self.user = UserFactory()
     self.user2 = UserFactory()
     self.project = ProjectFactory()
     op_spec = OperationSpecification.read(values=get_fxt_job_with_inputs())
     self.run = compile_operation_run(project_id=self.project.id,
                                      op_spec=op_spec,
                                      user_id=self.user.id)
Example #2
0
    def setUp(self):
        super().setUp()
        # Force tasks autodiscover
        from scheduler import tasks  # noqa

        self.user = UserFactory()
        self.project = ProjectFactory()
Example #3
0
    def setUp(self):
        super().setUp()

        settings.ARTIFACTS_ROOT = tempfile.mkdtemp()
        settings.LOGS_ROOT = tempfile.mkdtemp()
        settings.ARCHIVES_ROOT = tempfile.mkdtemp()
        self.client = BaseClient()
        self.user = UserFactory()
Example #4
0
    def setUp(self):
        super().setUp()
        self.user = UserFactory()
        self.project = self.factory_class()
        self.url = "/{}/{}/{}/".format(API_V1, self.user.username,
                                       self.project.name)
        self.queryset = self.model_class.objects.filter()
        self.object_query = self.model_class.objects.get(id=self.project.id)

        # Create related fields
        for _ in range(2):
            RunFactory(user=self.user, project=self.project)
Example #5
0
    def test_resume_run(self, auditor_record):
        run = resume_run(run=self.run)
        assert auditor_record.call_count == 2
        call_args_list = auditor_record.call_args_list
        assert call_args_list[0][0] == ()
        assert call_args_list[1][0] == ()
        assert call_args_list[0][1]["event_type"] == run_events.RUN_NEW_STATUS
        assert call_args_list[1][1]["event_type"] == run_events.RUN_RESUMED
        assert run.user == self.run.user
        assert run.kind == self.run.kind
        assert run.project == self.run.project
        assert run.name == self.run.name
        assert run.description == self.run.description
        assert run.content == self.run.content
        assert run.raw_content == self.run.raw_content
        assert run.readme == self.run.readme
        assert run.tags == self.run.tags
        assert run.status == V1Statuses.RESUMING
        assert run.cloning_kind is None
        assert run.original is None
        assert run.inputs == {"image": "foo/bar"}

        user = UserFactory()
        run = resume_run(
            run=self.run,
            user_id=user.id,
            name="new-name",
            description="new-description",
            content={"trigger": "all_done"},
            readme="new-readme",
            tags=["tag1", "tag2"],
        )
        assert run.user == user
        assert run.project == self.project
        assert run.name == "new-name"
        assert run.description == "new-description"
        assert run.content == self.run.content
        assert run.raw_content == self.run.raw_content
        assert run.readme == "new-readme"
        assert set(run.tags) == {"tag1", "tag2"}
        assert run.cloning_kind is None
        assert run.original is None
Example #6
0
 def setUp(self):
     super().setUp()
     self.user = UserFactory()
     self.project = ProjectFactory()
     self.run = RunFactory(project=self.project)