mirror of
https://github.com/trufflesecurity/trufflehog.git
synced 2024-11-10 15:14:38 +00:00
[THOG-774] - GitHub ignore repo full name (#848)
* Use github repo full name. * fix tests.
This commit is contained in:
parent
d29357c9d4
commit
2d6aadcb46
2 changed files with 6 additions and 6 deletions
|
@ -621,7 +621,7 @@ func (s *Source) getReposByOrg(ctx context.Context, org string) ([]string, error
|
|||
|
||||
s.log.Debugf("Listed repos for org %s page %d/%d", org, opts.Page, res.LastPage)
|
||||
for _, r := range someRepos {
|
||||
if s.ignoreRepo(r.GetName()) {
|
||||
if s.ignoreRepo(r.GetFullName()) {
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -680,7 +680,7 @@ func (s *Source) getReposByUser(ctx context.Context, user string) ([]string, err
|
|||
|
||||
s.log.Debugf("Listed repos for user %s page %d/%d", user, opts.Page, res.LastPage)
|
||||
for _, r := range someRepos {
|
||||
if s.ignoreRepo(r.GetName()) {
|
||||
if s.ignoreRepo(r.GetFullName()) {
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
|
@ -67,11 +67,11 @@ func TestAddReposByOrg(t *testing.T) {
|
|||
Reply(200).
|
||||
JSON([]map[string]string{
|
||||
{"clone_url": "super-secret-repo", "name": "super-secret-repo"},
|
||||
{"clone_url": "super-secret-repo2", "name": "super-secret-repo2"},
|
||||
{"clone_url": "super-secret-repo2", "full_name": "secret/super-secret-repo2"},
|
||||
})
|
||||
|
||||
s := initTestSource(nil)
|
||||
s.ignoreRepos = []string{"super-secret-repo2"}
|
||||
s.ignoreRepos = []string{"secret/super-secret-repo2"}
|
||||
// gock works here because github.NewClient is using the default HTTP Transport
|
||||
err := s.addRepos(context.TODO(), "super-secret-org", s.getReposByOrg)
|
||||
assert.Nil(t, err)
|
||||
|
@ -88,11 +88,11 @@ func TestAddReposByUser(t *testing.T) {
|
|||
Reply(200).
|
||||
JSON([]map[string]string{
|
||||
{"clone_url": "super-secret-repo", "name": "super-secret-repo"},
|
||||
{"clone_url": "super-secret-repo2", "name": "super-secret-repo2"},
|
||||
{"clone_url": "super-secret-repo2", "full_name": "secret/super-secret-repo2"},
|
||||
})
|
||||
|
||||
s := initTestSource(nil)
|
||||
s.ignoreRepos = []string{"super-secret-repo2"}
|
||||
s.ignoreRepos = []string{"secret/super-secret-repo2"}
|
||||
err := s.addRepos(context.TODO(), "super-secret-user", s.getReposByUser)
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, 1, len(s.repos))
|
||||
|
|
Loading…
Reference in a new issue