Skip to content

Commit 4d45a4f

Browse files
billnapierEnricoMi
andauthored
Add Organization.get_repos_for_code_security_config test (#3239)
Follow-up on #3095 and #3219. --------- Co-authored-by: Enrico Minack <github@enrico.minack.dev>
1 parent 7a11f84 commit 4d45a4f

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

tests/Organization.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -776,3 +776,10 @@ def testAttachDetachSecurityConfig(self):
776776

777777
self.assertEqual(config.id, repo_config.configuration.id)
778778
repo.detach_security_config()
779+
780+
def testGetReposForCodeSecurityConfig(self):
781+
repo_statuses = self.org.get_repos_for_code_security_config(id=182032)
782+
status = repo_statuses[0]
783+
self.assertEqual(status.status, "enforced")
784+
self.assertIsNotNone(status.repository)
785+
self.assertEqual(status.repository.full_name, "BeaverSoftware/truth")
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
https
2+
GET
3+
api.github.com
4+
None
5+
/orgs/BeaverSoftware/code-security/configurations/182032/repositories
6+
{'Accept': 'application/vnd.github.nebula-preview+json', 'Authorization': 'token private_token_removed', 'User-Agent': 'PyGithub/Python'}
7+
None
8+
200
9+
[('Date', 'Sat, 22 Feb 2025 06:09:04 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With'), ('ETag', 'W/"5876e0f1018339cd105c3a2858f713badde7b3d886c274f9efa310007d5fee27"'), ('X-OAuth-Scopes', 'admin:org, repo, user'), ('X-Accepted-OAuth-Scopes', 'admin:org, write:org'), ('github-authentication-token-expiration', '2025-03-19 04:09:19 UTC'), ('X-GitHub-Media-Type', 'github.v3; param=nebula-preview; format=json'), ('Link', '<https://api.github.com/organizations/1342004/code-security/configurations/182032/repositories?per_page=1&after=Y3Vyc29yOnYyOpLOAB2Ng84AgUw1>; rel="next"'), ('x-github-api-version-selected', '2022-11-28'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4962'), ('X-RateLimit-Reset', '1740207857'), ('X-RateLimit-Used', '38'), ('X-RateLimit-Resource', 'core'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset'), ('Access-Control-Allow-Origin', '*'), ('Strict-Transport-Security', 'max-age=31536000; includeSubdomains; preload'), ('X-Frame-Options', 'deny'), ('X-Content-Type-Options', 'nosniff'), ('X-XSS-Protection', '0'), ('Referrer-Policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('Content-Security-Policy', "default-src 'none'"), ('Content-Encoding', 'gzip'), ('Transfer-Encoding', 'chunked'), ('X-GitHub-Request-Id', 'A801:2D9847:14C1D5E:29F9CCB:67B96A00'), ('Server', 'github.com')]
10+
[{"status":"enforced","repository":{"id":1936771,"node_id":"MDEwOlJlcG9zaXRvcnkxOTM2Nzcx","name":"truth","full_name":"BeaverSoftware/truth","private":false,"owner":{"login":"BeaverSoftware","id":1342004,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzNDIwMDQ=","avatar_url":"https://avatars.githubusercontent.com/u/1342004?v=4","gravatar_id":"","url":"https://api.github.com/users/BeaverSoftware","html_url":"https://github.com/BeaverSoftware","followers_url":"https://api.github.com/users/BeaverSoftware/followers","following_url":"https://api.github.com/users/BeaverSoftware/following{/other_user}","gists_url":"https://api.github.com/users/BeaverSoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/BeaverSoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BeaverSoftware/subscriptions","organizations_url":"https://api.github.com/users/BeaverSoftware/orgs","repos_url":"https://api.github.com/users/BeaverSoftware/repos","events_url":"https://api.github.com/users/BeaverSoftware/events{/privacy}","received_events_url":"https://api.github.com/users/BeaverSoftware/received_events","type":"Organization","user_view_type":"public","site_admin":false},"html_url":"https://github.com/BeaverSoftware/truth","description":"Fluent assertions for Java and Android","fork":false,"url":"https://api.github.com/repos/BeaverSoftware/truth","forks_url":"https://api.github.com/repos/BeaverSoftware/truth/forks","keys_url":"https://api.github.com/repos/BeaverSoftware/truth/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BeaverSoftware/truth/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BeaverSoftware/truth/teams","hooks_url":"https://api.github.com/repos/BeaverSoftware/truth/hooks","issue_events_url":"https://api.github.com/repos/BeaverSoftware/truth/issues/events{/number}","events_url":"https://api.github.com/repos/BeaverSoftware/truth/events","assignees_url":"https://api.github.com/repos/BeaverSoftware/truth/assignees{/user}","branches_url":"https://api.github.com/repos/BeaverSoftware/truth/branches{/branch}","tags_url":"https://api.github.com/repos/BeaverSoftware/truth/tags","blobs_url":"https://api.github.com/repos/BeaverSoftware/truth/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BeaverSoftware/truth/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BeaverSoftware/truth/git/refs{/sha}","trees_url":"https://api.github.com/repos/BeaverSoftware/truth/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BeaverSoftware/truth/statuses/{sha}","languages_url":"https://api.github.com/repos/BeaverSoftware/truth/languages","stargazers_url":"https://api.github.com/repos/BeaverSoftware/truth/stargazers","contributors_url":"https://api.github.com/repos/BeaverSoftware/truth/contributors","subscribers_url":"https://api.github.com/repos/BeaverSoftware/truth/subscribers","subscription_url":"https://api.github.com/repos/BeaverSoftware/truth/subscription","commits_url":"https://api.github.com/repos/BeaverSoftware/truth/commits{/sha}","git_commits_url":"https://api.github.com/repos/BeaverSoftware/truth/git/commits{/sha}","comments_url":"https://api.github.com/repos/BeaverSoftware/truth/comments{/number}","issue_comment_url":"https://api.github.com/repos/BeaverSoftware/truth/issues/comments{/number}","contents_url":"https://api.github.com/repos/BeaverSoftware/truth/contents/{+path}","compare_url":"https://api.github.com/repos/BeaverSoftware/truth/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BeaverSoftware/truth/merges","archive_url":"https://api.github.com/repos/BeaverSoftware/truth/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BeaverSoftware/truth/downloads","issues_url":"https://api.github.com/repos/BeaverSoftware/truth/issues{/number}","pulls_url":"https://api.github.com/repos/BeaverSoftware/truth/pulls{/number}","milestones_url":"https://api.github.com/repos/BeaverSoftware/truth/milestones{/number}","notifications_url":"https://api.github.com/repos/BeaverSoftware/truth/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BeaverSoftware/truth/labels{/name}","releases_url":"https://api.github.com/repos/BeaverSoftware/truth/releases{/id}","deployments_url":"https://api.github.com/repos/BeaverSoftware/truth/deployments"}}]

0 commit comments

Comments
 (0)