Esempio n. 1
0
 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)
Esempio n. 2
0
 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)
Esempio n. 3
0
 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)
Esempio n. 4
0
 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)
Esempio n. 5
0
 def func():
     repo_utils.enforce_repo_state(
         self.repo_url, dest_path,
         branch)
Esempio n. 6
0
 def test_enforce_invalid_branch(self):
     with raises(ValueError):
         repo_utils.enforce_repo_state(self.repo_url, self.dest_path, 'a b')
Esempio n. 7
0
 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)
Esempio n. 8
0
 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)