-
Notifications
You must be signed in to change notification settings - Fork 769
Make getTeambySlug faster #733
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
fbf6c73
Make getTeambySlug fast enought
ingwarsw 2e25f37
Format code
ingwarsw 9213f80
Add comment to deprecation
ingwarsw 960a13d
Merge branch 'master' into add_get_team_by_slug
ingwarsw 6cbb1a0
Fix tests partially
ingwarsw 157724b
Fix rest of tests
ingwarsw 2aebe97
Add/restore test for getTeam
ingwarsw 6c8b466
Add mocks for tests
ingwarsw f6210cc
Change variable name to something meningfull
ingwarsw 1a42381
Fix javadocs
ingwarsw fca425d
Add test for old getteam method
ingwarsw 78b9ff4
Fix tests
ingwarsw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -234,16 +234,28 @@ private boolean shouldBelongToTeam(String organizationName, String teamName) thr | |
| return team.hasMember(gitHub.getMyself()); | ||
| } | ||
|
|
||
| @Ignore("Needs mocking check") | ||
| @Test | ||
| public void testShouldFetchTeam() throws Exception { | ||
| GHOrganization j = gitHub.getOrganization(GITHUB_API_TEST_ORG); | ||
| GHTeam teamByName = j.getTeams().get("Core Developers"); | ||
| GHOrganization organization = gitHub.getOrganization(GITHUB_API_TEST_ORG); | ||
| GHTeam teamByName = organization.getTeams().get("Core Developers"); | ||
|
|
||
| GHTeam teamById = gitHub.getTeam(teamByName.getId()); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, just because it is deprecated doesn't mean we can remove the test for it. We must ensure it continues to work until it is removed. |
||
| assertNotNull(teamById); | ||
|
|
||
| assertEquals(teamByName, teamById); | ||
| assertEquals(teamByName.getId(), teamById.getId()); | ||
| assertEquals(teamByName.getDescription(), teamById.getDescription()); | ||
| } | ||
|
|
||
| @Test | ||
| public void testShouldFetchTeamFromOrganization() throws Exception { | ||
| GHOrganization organization = gitHub.getOrganization(GITHUB_API_TEST_ORG); | ||
| GHTeam teamByName = organization.getTeams().get("Core Developers"); | ||
|
|
||
| GHTeam teamById = organization.getTeam(teamByName.getId()); | ||
| assertNotNull(teamById); | ||
|
|
||
| assertEquals(teamByName.getId(), teamById.getId()); | ||
| assertEquals(teamByName.getDescription(), teamById.getDescription()); | ||
| } | ||
|
|
||
| @Ignore("Needs mocking check") | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
.../orgs_github-api-test-org_teams_core-developers-b7236bc9-4447-4721-acdb-7598066525d6.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| { | ||
| "name": "Core Developers", | ||
| "id": 820406, | ||
| "node_id": "MDQ6VGVhbTgyMDQwNg==", | ||
| "slug": "core-developers", | ||
| "description": "A random team", | ||
| "privacy": "secret", | ||
| "url": "https://api.github.com/organizations/7544739/team/820406", | ||
| "html_url": "https://github.com/orgs/github-api-test-org/teams/core-developers", | ||
| "members_url": "https://api.github.com/organizations/7544739/team/820406/members{/member}", | ||
| "repositories_url": "https://api.github.com/organizations/7544739/team/820406/repos", | ||
| "permission": "pull", | ||
| "created_at": "2014-05-10T19:40:03Z", | ||
| "updated_at": "2014-05-10T19:40:03Z", | ||
| "members_count": 1, | ||
| "repos_count": 1, | ||
| "organization": { | ||
| "login": "github-api-test-org", | ||
| "id": 7544739, | ||
| "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", | ||
| "url": "https://api.github.com/orgs/github-api-test-org", | ||
| "repos_url": "https://api.github.com/orgs/github-api-test-org/repos", | ||
| "events_url": "https://api.github.com/orgs/github-api-test-org/events", | ||
| "hooks_url": "https://api.github.com/orgs/github-api-test-org/hooks", | ||
| "issues_url": "https://api.github.com/orgs/github-api-test-org/issues", | ||
| "members_url": "https://api.github.com/orgs/github-api-test-org/members{/member}", | ||
| "public_members_url": "https://api.github.com/orgs/github-api-test-org/public_members{/member}", | ||
| "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", | ||
| "description": null, | ||
| "is_verified": false, | ||
| "has_organization_projects": true, | ||
| "has_repository_projects": true, | ||
| "public_repos": 26, | ||
| "public_gists": 0, | ||
| "followers": 0, | ||
| "following": 0, | ||
| "html_url": "https://github.com/github-api-test-org", | ||
| "created_at": "2014-05-10T19:39:11Z", | ||
| "updated_at": "2015-04-20T00:42:30Z", | ||
| "type": "Organization" | ||
| }, | ||
| "parent": null | ||
| } |
46 changes: 46 additions & 0 deletions
46
...k/testOrgTeamBySlug/mappings/orgs_github-api-test-org_teams_core-developers-4-b7236b.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| { | ||
| "id": "b7236bc9-4447-4721-acdb-7598066525d6", | ||
| "name": "orgs_github-api-test-org_teams_core-developers", | ||
| "request": { | ||
| "url": "/orgs/github-api-test-org/teams/core-developers", | ||
| "method": "GET", | ||
| "headers": { | ||
| "Accept": { | ||
| "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" | ||
| } | ||
| } | ||
| }, | ||
| "response": { | ||
| "status": 200, | ||
| "bodyFileName": "orgs_github-api-test-org_teams_core-developers-b7236bc9-4447-4721-acdb-7598066525d6.json", | ||
| "headers": { | ||
| "Date": "Tue, 17 Mar 2020 09:18:50 GMT", | ||
| "Content-Type": "application/json; charset=utf-8", | ||
| "Server": "GitHub.com", | ||
| "Status": "200 OK", | ||
| "X-RateLimit-Limit": "5000", | ||
| "X-RateLimit-Remaining": "4995", | ||
| "X-RateLimit-Reset": "1584440312", | ||
| "Cache-Control": "private, max-age=60, s-maxage=60", | ||
| "Vary": [ | ||
| "Accept, Authorization, Cookie, X-GitHub-OTP", | ||
| "Accept-Encoding, Accept, X-Requested-With" | ||
| ], | ||
| "ETag": "W/\"1201d96396c062b2208db689dc6a3887\"", | ||
| "Last-Modified": "Sat, 10 May 2014 19:40:03 GMT", | ||
| "X-OAuth-Scopes": "admin:org, admin:public_key, admin:repo_hook, notifications, repo, user", | ||
| "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", | ||
| "X-GitHub-Media-Type": "unknown, github.v3", | ||
| "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", | ||
| "X-Frame-Options": "deny", | ||
| "X-Content-Type-Options": "nosniff", | ||
| "X-XSS-Protection": "1; mode=block", | ||
| "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", | ||
| "Content-Security-Policy": "default-src 'none'", | ||
| "X-GitHub-Request-Id": "F97C:520F:195318:2E8EA9:5E7095FA" | ||
| } | ||
| }, | ||
| "uuid": "b7236bc9-4447-4721-acdb-7598066525d6", | ||
| "persistent": true, | ||
| "insertionIndex": 4 | ||
| } |
43 changes: 43 additions & 0 deletions
43
...hTeam/__files/organizations_7544739_team_820406-8b1ba756-0fb7-49bf-8cd8-0febdccefd7e.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| { | ||
| "name": "Core Developers", | ||
| "id": 820406, | ||
| "node_id": "MDQ6VGVhbTgyMDQwNg==", | ||
| "slug": "core-developers", | ||
| "description": "A random team", | ||
| "privacy": "secret", | ||
| "url": "https://api.github.com/organizations/7544739/team/820406", | ||
| "html_url": "https://github.com/orgs/github-api-test-org/teams/core-developers", | ||
| "members_url": "https://api.github.com/organizations/7544739/team/820406/members{/member}", | ||
| "repositories_url": "https://api.github.com/organizations/7544739/team/820406/repos", | ||
| "permission": "pull", | ||
| "created_at": "2014-05-10T19:40:03Z", | ||
| "updated_at": "2014-05-10T19:40:03Z", | ||
| "members_count": 1, | ||
| "repos_count": 1, | ||
| "organization": { | ||
| "login": "github-api-test-org", | ||
| "id": 7544739, | ||
| "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", | ||
| "url": "https://api.github.com/orgs/github-api-test-org", | ||
| "repos_url": "https://api.github.com/orgs/github-api-test-org/repos", | ||
| "events_url": "https://api.github.com/orgs/github-api-test-org/events", | ||
| "hooks_url": "https://api.github.com/orgs/github-api-test-org/hooks", | ||
| "issues_url": "https://api.github.com/orgs/github-api-test-org/issues", | ||
| "members_url": "https://api.github.com/orgs/github-api-test-org/members{/member}", | ||
| "public_members_url": "https://api.github.com/orgs/github-api-test-org/public_members{/member}", | ||
| "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", | ||
| "description": null, | ||
| "is_verified": false, | ||
| "has_organization_projects": true, | ||
| "has_repository_projects": true, | ||
| "public_repos": 26, | ||
| "public_gists": 0, | ||
| "followers": 0, | ||
| "following": 0, | ||
| "html_url": "https://github.com/github-api-test-org", | ||
| "created_at": "2014-05-10T19:39:11Z", | ||
| "updated_at": "2015-04-20T00:42:30Z", | ||
| "type": "Organization" | ||
| }, | ||
| "parent": null | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
...etchTeam/__files/orgs_github-api-test-org_teams-d833590f-9896-462c-846b-712b50377536.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| [ | ||
| { | ||
| "name": "Core Developers", | ||
| "id": 820406, | ||
| "node_id": "MDQ6VGVhbTgyMDQwNg==", | ||
| "slug": "core-developers", | ||
| "description": "A random team", | ||
| "privacy": "secret", | ||
| "url": "https://api.github.com/organizations/7544739/team/820406", | ||
| "html_url": "https://github.com/orgs/github-api-test-org/teams/core-developers", | ||
| "members_url": "https://api.github.com/organizations/7544739/team/820406/members{/member}", | ||
| "repositories_url": "https://api.github.com/organizations/7544739/team/820406/repos", | ||
| "permission": "pull", | ||
| "parent": null | ||
| }, | ||
| { | ||
| "name": "dummy-team", | ||
| "id": 3451996, | ||
| "node_id": "MDQ6VGVhbTM0NTE5OTY=", | ||
| "slug": "dummy-team", | ||
| "description": "Updated by API TestModified", | ||
| "privacy": "secret", | ||
| "url": "https://api.github.com/organizations/7544739/team/3451996", | ||
| "html_url": "https://github.com/orgs/github-api-test-org/teams/dummy-team", | ||
| "members_url": "https://api.github.com/organizations/7544739/team/3451996/members{/member}", | ||
| "repositories_url": "https://api.github.com/organizations/7544739/team/3451996/repos", | ||
| "permission": "pull", | ||
| "parent": null | ||
| }, | ||
| { | ||
| "name": "Owners-team", | ||
| "id": 820404, | ||
| "node_id": "MDQ6VGVhbTgyMDQwNA==", | ||
| "slug": "owners-team", | ||
| "description": null, | ||
| "privacy": "secret", | ||
| "url": "https://api.github.com/organizations/7544739/team/820404", | ||
| "html_url": "https://github.com/orgs/github-api-test-org/teams/owners-team", | ||
| "members_url": "https://api.github.com/organizations/7544739/team/820404/members{/member}", | ||
| "repositories_url": "https://api.github.com/organizations/7544739/team/820404/repos", | ||
| "permission": "admin", | ||
| "parent": null | ||
| }, | ||
| { | ||
| "name": "tricky-team", | ||
| "id": 3454508, | ||
| "node_id": "MDQ6VGVhbTM0NTQ1MDg=", | ||
| "slug": "tricky-team", | ||
| "description": "", | ||
| "privacy": "secret", | ||
| "url": "https://api.github.com/organizations/7544739/team/3454508", | ||
| "html_url": "https://github.com/orgs/github-api-test-org/teams/tricky-team", | ||
| "members_url": "https://api.github.com/organizations/7544739/team/3454508/members{/member}", | ||
| "repositories_url": "https://api.github.com/organizations/7544739/team/3454508/repos", | ||
| "permission": "pull", | ||
| "parent": null | ||
| } | ||
| ] |
43 changes: 43 additions & 0 deletions
43
...remock/testShouldFetchTeam/__files/teams_820406-9302cc40-d07a-4ad2-b958-f035a849e3fb.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| { | ||
| "name": "Core Developers", | ||
| "id": 820406, | ||
| "node_id": "MDQ6VGVhbTgyMDQwNg==", | ||
| "slug": "core-developers", | ||
| "description": "A random team", | ||
| "privacy": "secret", | ||
| "url": "https://api.github.com/organizations/7544739/team/820406", | ||
| "html_url": "https://github.com/orgs/github-api-test-org/teams/core-developers", | ||
| "members_url": "https://api.github.com/organizations/7544739/team/820406/members{/member}", | ||
| "repositories_url": "https://api.github.com/organizations/7544739/team/820406/repos", | ||
| "permission": "pull", | ||
| "created_at": "2014-05-10T19:40:03Z", | ||
| "updated_at": "2014-05-10T19:40:03Z", | ||
| "members_count": 1, | ||
| "repos_count": 1, | ||
| "organization": { | ||
| "login": "github-api-test-org", | ||
| "id": 7544739, | ||
| "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", | ||
| "url": "https://api.github.com/orgs/github-api-test-org", | ||
| "repos_url": "https://api.github.com/orgs/github-api-test-org/repos", | ||
| "events_url": "https://api.github.com/orgs/github-api-test-org/events", | ||
| "hooks_url": "https://api.github.com/orgs/github-api-test-org/hooks", | ||
| "issues_url": "https://api.github.com/orgs/github-api-test-org/issues", | ||
| "members_url": "https://api.github.com/orgs/github-api-test-org/members{/member}", | ||
| "public_members_url": "https://api.github.com/orgs/github-api-test-org/public_members{/member}", | ||
| "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", | ||
| "description": null, | ||
| "is_verified": false, | ||
| "has_organization_projects": true, | ||
| "has_repository_projects": true, | ||
| "public_repos": 26, | ||
| "public_gists": 0, | ||
| "followers": 0, | ||
| "following": 0, | ||
| "html_url": "https://github.com/github-api-test-org", | ||
| "created_at": "2014-05-10T19:39:11Z", | ||
| "updated_at": "2015-04-20T00:42:30Z", | ||
| "type": "Organization" | ||
| }, | ||
| "parent": null | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.