示例#1
0
    def test_project_ci(self):
        project = ProjectFactory()
        self.assertEqual(project.has_ci, False)

        ci = CIFactory(project=project)
        self.assertEqual(project.has_ci, True)

        ci.delete()
        project.refresh_from_db()
        self.assertEqual(project.has_ci, False)
示例#2
0
    def setUp(self):
        super().setUp()

        self.project = ProjectFactory()
        # Set ci
        self.ci = CIFactory(project=self.project)
示例#3
0
    def test_project_ci_code_ref(self):
        project = ProjectFactory()
        repo = ExternalRepoFactory(project=project, git_url='https://github.com/polyaxon/empty.git')
        ci = CIFactory(project=project)
        assert ci.code_reference is None

        code_ref = CodeReferenceFactory(external_repo=repo)
        ci.code_reference = code_ref
        ci.save()
        ci.refresh_from_db()
        assert ci.code_reference == code_ref

        code_ref = CodeReferenceFactory(external_repo=repo)
        ci.code_reference = code_ref
        ci.save()
        ci.refresh_from_db()
        assert ci.code_reference == code_ref
示例#4
0
 def test_create_project_with_ci_code_ref(self):
     project = ProjectFactory()
     repo = RepoFactory(project=project)
     code_ref = CodeReferenceFactory(repo=repo)
     ci = CIFactory(project=project, code_reference=code_ref)
     assert ci.code_reference == code_ref