Beispiel #1
0
def get_oss_fuzz_repo():
    """Clones a temporary copy of the OSS-Fuzz repo. Returns the path to the
  repo."""
    repo_name = 'oss-fuzz'
    with tempfile.TemporaryDirectory() as tmp_dir:
        repo_manager._clone(OSS_FUZZ_REPO_URL, tmp_dir, repo_name)
        yield os.path.join(tmp_dir, repo_name)
Beispiel #2
0
 def test_clone_with_username(self, mock_execute):  # pylint: disable=no-self-use
     """Test clone with username."""
     repo_manager._clone('https://github.com/fake/repo.git',
                         '/',
                         'name',
                         username='******',
                         password='******')
     mock_execute.assert_called_once_with([
         'git', 'clone', 'https://*****:*****@github.com/fake/repo.git',
         'name'
     ],
                                          location='/',
                                          check_result=True,
                                          log_command=False)
Beispiel #3
0
 def test_clone_invalid_repo(self):
     """Tests that cloning an invalid repo will fail."""
     with tempfile.TemporaryDirectory() as tmp_dir:
         with self.assertRaises(RuntimeError):
             repo_manager._clone('https://github.com/oss-fuzz-not-real.git',
                                 tmp_dir, 'oss-fuzz')