Esempio n. 1
0
 def test_fetch_branch_different_git_versions(self, mock_popen, git_str):
     """
     Newer git versions return a lower case string
     See: https://github.com/git/git/commit/0b9c3afdbfb629363
     """
     branch_name = 'nobranch'
     process_mock = mock.Mock()
     attrs = {
         'wait.return_value': 1,
         'stdout.read.return_value': f"{git_str} {branch_name}".encode(),
     }
     process_mock.configure_mock(**attrs)
     mock_popen.return_value = process_mock
     with raises(BranchNotFoundError):
         repo_utils.fetch_branch('', branch_name)
Esempio n. 2
0
 def test_fetch_branch_fake_branch(self):
     repo_utils.clone_repo(self.repo_url, self.dest_path, 'master')
     with raises(BranchNotFoundError):
         repo_utils.fetch_branch(self.dest_path, 'nobranch')
Esempio n. 3
0
 def test_fetch_branch_no_repo(self):
     fake_dest_path = self.temp_path + '/not_a_repo'
     assert not os.path.exists(fake_dest_path)
     with raises(OSError):
         repo_utils.fetch_branch(fake_dest_path, 'master')
     assert not os.path.exists(fake_dest_path)