Exemple #1
0
    def test_check_duplicate_no_reserved_version(self, api_v2):
        create_git_branch(self.repo, 'no-reserved')
        create_git_tag(self.repo, 'no-reserved')

        version = self.project.versions.get(slug=LATEST)
        sync_repository = tasks.UpdateDocsTaskStep()
        sync_repository.version = version
        sync_repository.project = self.project
        sync_repository.sync_repo()

        api_v2.project().sync_versions.post.assert_called()
Exemple #2
0
    def test_check_duplicate_reserved_version_stable(self, api_v2):
        create_git_branch(self.repo, 'stable')
        create_git_tag(self.repo, 'stable')

        version = self.project.versions.get(slug=LATEST)
        sync_repository = tasks.UpdateDocsTaskStep()
        sync_repository.version = version
        sync_repository.project = self.project
        with self.assertRaises(RepositoryError) as e:
            sync_repository.sync_repo()
        self.assertEqual(str(e.exception),
                         RepositoryError.DUPLICATED_RESERVED_VERSIONS)
Exemple #3
0
    def get_update_docs_task(self):
        build_env = LocalBuildEnvironment(self.project,
                                          self.version,
                                          record=False)

        update_docs = tasks.UpdateDocsTaskStep(
            build_env=build_env,
            config=load_yaml_config(self.version),
            project=self.project,
            version=self.version,
        )
        return update_docs
    def get_update_docs_task(self, version):
        build_env = LocalBuildEnvironment(
            version.project, version, record=False,
        )

        update_docs = tasks.UpdateDocsTaskStep(
            build_env=build_env,
            project=version.project,
            version=version,
            build={
                'id': 99,
                'state': BUILD_STATE_TRIGGERED,
            },
        )
        return update_docs
Exemple #5
0
    def get_update_docs_task(self):
        build_env = LocalBuildEnvironment(
            self.project, self.version, record=False,
        )

        update_docs = tasks.UpdateDocsTaskStep(
            build_env=build_env,
            config=load_yaml_config(self.version),
            project=self.project,
            version=self.version,
            build={
                'id': 99,
                'state': BUILD_STATE_TRIGGERED,
            },
        )
        return update_docs
    def test_check_duplicate_reserved_version_stable(self, checkout_path,
                                                     api_v2):
        create_git_branch(self.repo, 'stable')
        create_git_tag(self.repo, 'stable')

        # Create dir where to clone the repo
        local_repo = os.path.join(mkdtemp(), 'local')
        os.mkdir(local_repo)
        checkout_path.return_value = local_repo

        version = self.project.versions.get(slug=LATEST)
        sync_repository = tasks.UpdateDocsTaskStep()
        sync_repository.version = version
        sync_repository.project = self.project
        with self.assertRaises(RepositoryError) as e:
            sync_repository.sync_repo()
        self.assertEqual(str(e.exception),
                         RepositoryError.DUPLICATED_RESERVED_VERSIONS)
Exemple #7
0
    def test_check_duplicate_reserved_version_latest(self, checkout_path, api_v2):
        checkout_path.return_value = self.project.repo
        create_git_branch(self.repo, 'latest')
        create_git_tag(self.repo, 'latest')

        version = self.project.versions.get(slug=LATEST)
        sync_repository = tasks.UpdateDocsTaskStep()
        sync_repository.version = version
        sync_repository.project = self.project
        with self.assertRaises(RepositoryError) as e:
            sync_repository.sync_repo()
        self.assertEqual(
            str(e.exception),
            RepositoryError.DUPLICATED_RESERVED_VERSIONS
        )

        delete_git_branch(self.repo, 'latest')
        sync_repository.sync_repo()
        api_v2.project().sync_versions.post.assert_called()