Example #1
0
    def test_remove_only_temp_repos(self):
        # First, we'll clone the remote repo
        git_url = "https://github.com/dxa4481/truffleHog.git"
        project_path, created = truffleHog.clone_git_repo(git_url)
        self.assertTrue(re.search(r'^/tmp/', project_path))
        self.assertTrue(created)

        # Second, we'll use a local repo without cloning to find strigs
        truffleHog.find_strings('file://' + project_path)
        self.assertTrue(os.path.exists(project_path))
Example #2
0
    def test_file_repo(self):
        # First, we'll clone the remote repo
        git_url = "https://github.com/dxa4481/truffleHog.git"
        project_path_1, c = truffleHog.clone_git_repo(git_url)
        self.assertTrue(re.search(r'^/tmp/', project_path_1))

        # Second, we'll use a local repo without cloning
        project_path_2, c = truffleHog.clone_git_repo('file://' +
                                                      project_path_1)
        self.assertTrue(re.search(r'^/tmp/', project_path_2))
        self.assertEqual(project_path_1, project_path_2)

        # Third, we'll use a sloppy filepath as a project repo address
        project_path_3, c = truffleHog.clone_git_repo(project_path_2)
        self.assertTrue(re.search(r'^/tmp/', project_path_3))
        self.assertEqual(project_path_2, project_path_3)

        # Fourth, we'll force another clone from a local repo
        project_path_4, c = truffleHog.clone_git_repo('file://' +
                                                      project_path_3,
                                                      force=True)
        self.assertTrue(re.search(r'^/tmp/', project_path_4))
        self.assertNotEqual(project_path_3, project_path_4)
Example #3
0
 def test_cloning(self):
     project_path = truffleHog.clone_git_repo(
         "https://github.com/dxa4481/truffleHog.git")
     license_file = os.path.join(project_path, "LICENSE")
     self.assertTrue(os.path.isfile(license_file))
Example #4
0
 def test_cloning(self):
     project_path = truffleHog.clone_git_repo("https://github.com/dxa4481/truffleHog.git")
     license_file = os.path.join(project_path, "LICENSE")
     self.assertTrue(os.path.isfile(license_file))
Example #5
0
 def test_cloning(self):
     project_path, _ = truffleHog.clone_git_repo(self.test_repo)
     license_file = os.path.join(project_path, "LICENSE")
     self.assertTrue(os.path.isfile(license_file))