def test_copy_repo_path_to_tmp_dir(self): project = ProjectFactory() repo_path = '{}/{}/{}/{}'.format(conf.get('REPOS_MOUNT_PATH'), 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))
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))
def create_tmp_repo(self): # Create a tmp copy of the repo before starting the build return copy_to_tmp_dir(path=self.repo_path, dir_name=os.path.join(self.uuid, self.image_tag, self.folder_name))