def test_enforce_multiple_calls_different_branches(self): with raises(BranchNotFoundError): repo_utils.enforce_repo_state(self.repo_url, self.dest_path, 'blah1') assert not os.path.exists(self.dest_path) repo_utils.enforce_repo_state(self.repo_url, self.dest_path, 'master') assert os.path.exists(self.dest_path) repo_utils.enforce_repo_state(self.repo_url, self.dest_path, 'master') assert os.path.exists(self.dest_path) with raises(BranchNotFoundError): repo_utils.enforce_repo_state(self.repo_url, self.dest_path, 'blah2') assert not os.path.exists(self.dest_path) repo_utils.enforce_repo_state(self.repo_url, self.dest_path, 'master') assert os.path.exists(self.dest_path)
def test_enforce_multiple_calls_same_branch(self): repo_utils.enforce_repo_state(self.repo_url, self.dest_path, 'master') assert os.path.exists(self.dest_path) repo_utils.enforce_repo_state(self.repo_url, self.dest_path, 'master') assert os.path.exists(self.dest_path) repo_utils.enforce_repo_state(self.repo_url, self.dest_path, 'master') assert os.path.exists(self.dest_path)
def test_enforce_non_existing_branch(self): with raises(BranchNotFoundError): repo_utils.enforce_repo_state(self.repo_url, self.dest_path, 'blah') assert not os.path.exists(self.dest_path)
def test_enforce_existing_branch(self): repo_utils.enforce_repo_state(self.repo_url, self.dest_path, 'master') assert os.path.exists(self.dest_path)
def func(): repo_utils.enforce_repo_state( self.repo_url, dest_path, branch)
def test_enforce_invalid_branch(self): with raises(ValueError): repo_utils.enforce_repo_state(self.repo_url, self.dest_path, 'a b')
def test_enforce_non_existing_commit(self): with raises(CommitNotFoundError): repo_utils.enforce_repo_state( self.repo_url, self.dest_path, 'master', 'c69e90807d222c1719c45c8c758bf6fac3d985f1') assert not os.path.exists(self.dest_path)
def test_enforce_existing_commit(self): repo_utils.enforce_repo_state(self.repo_url, self.dest_path, 'master', self.commit) assert os.path.exists(self.dest_path)