def test_process_github_repos_with_no_ignore_list(self, github_mock, org_mock, pag_mock): # given scanner = GitHubScanner('url', 'token', 'org', [], False, annotate_latest_commit_id=True) repos = assemble_repos() create_mocks(github_mock, org_mock, pag_mock, repos) scanner._gh = github_mock # when findings = scanner._process_repos(None, None) # then org_mock.get_repos.assert_called_with(type='all', sort='pushed', direction='asc') self.assertEqual(6, len(findings), msg='There should be exactly 6 findings') for finding in findings: self.assertEqual(finding['name'], 'GitHub Repo', msg=self.wrong_output_msg) self.assertEqual(finding['attributes']["last_commit_id"], "deadbeef")
def test_process_github_repos_with_ignore_repos(self, github_mock, org_mock, pag_mock): # given scanner = GitHubScanner('url', 'token', 'org', [1], False) repos = assemble_repos() create_mocks(github_mock, org_mock, pag_mock, repos) scanner._gh = github_mock # when findings = scanner._process_repos(None, None) # then github_mock.get_organization.assert_called_with('org') self.assertEqual(4, len(findings), msg='There should be exactly 4 findings')