Пример #1
0
    def test_copy_repo_path_to_tmp_dir(self):
        project = ProjectFactory()
        repo_path = '{}/{}/{}/{}'.format(settings.REPOS_ROOT,
                                         project.user.username, project.name,
                                         project.name)
        self.assertFalse(os.path.exists(repo_path))

        repo = RepoFactory(project=project)
        assert repo.path == repo_path
        self.assertTrue(os.path.exists(repo_path))
        git_file_path = '{}/.git'.format(repo_path)
        self.assertTrue(os.path.exists(git_file_path))

        copy_to_tmp_dir(repo_path, 'new')
        git_file_path = '{}/.git'.format(get_tmp_path('new'))
        self.assertTrue(os.path.exists(git_file_path))
Пример #2
0
 def create_tmp_repo(self):
     # Create a tmp copy of the repo before starting the build
     return copy_to_tmp_dir(self.repo_path,
                            os.path.join(self.image_tag, self.folder_name))