Skip to content
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

Added description field to GHTeam class. #478

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Record snapshot for test
  • Loading branch information
bitwiseman committed Oct 3, 2019
commit 413a316b15946594e0264489eee99597c3e8b59b
27 changes: 15 additions & 12 deletions src/test/java/org/kohsuke/github/GHTeamTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,29 @@
import java.io.IOException;
import java.util.Random;

public class GHTeamTest extends AbstractGitHubApiTestBase {
public class GHTeamTest extends AbstractGitHubApiWireMockTest {

@Test
public void testSetDescription() throws IOException {

Random random = new Random();
String description = "Updated by API Test " + String.valueOf(random.nextInt());
String organizationSlug = "martinvz-test";
String description = "Updated by API Test";
String teamSlug = "dummy-team";

// Set the description.
{
GHTeam team = gitHub.getOrganization(organizationSlug).getTeamBySlug(teamSlug);
team.setDescription(description);
}
GHTeam team = gitHub.getOrganization(GITHUB_API_TEST_ORG).getTeamBySlug(teamSlug);
team.setDescription(description);

// Check that it was set correctly.
{
GHTeam team = gitHub.getOrganization(organizationSlug).getTeamBySlug(teamSlug);
assertEquals(description, team.getDescription());
}
team = gitHub.getOrganization(GITHUB_API_TEST_ORG).getTeamBySlug(teamSlug);
assertEquals(description, team.getDescription());

description += "Modified";

// Set the description.
team.setDescription(description);

// Check that it was set correctly.
team = gitHub.getOrganization(GITHUB_API_TEST_ORG).getTeamBySlug(teamSlug);
assertEquals(description, team.getDescription());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"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": 9,
"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",
"total_private_repos": 0,
"owned_private_repos": 0,
"private_gists": 0,
"disk_usage": 132,
"collaborators": 0,
"billing_email": "kk@kohsuke.org",
"default_repository_permission": "none",
"members_can_create_repositories": false,
"two_factor_requirement_enabled": false,
"plan": {
"name": "free",
"space": 976562499,
"private_repos": 0,
"filled_seats": 3,
"seats": 0
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
[
{
"name": "Owners",
"id": 820404,
"node_id": "MDQ6VGVhbTgyMDQwNA==",
"slug": "owners",
"description": null,
"privacy": "secret",
"url": "https://api.github.com/teams/820404",
"html_url": "https://github.com/orgs/github-api-test-org/teams/owners",
"members_url": "https://api.github.com/teams/820404/members{/member}",
"repositories_url": "https://api.github.com/teams/820404/repos",
"permission": "admin"
},
{
"name": "Core Developers",
"id": 820406,
"node_id": "MDQ6VGVhbTgyMDQwNg==",
"slug": "core-developers",
"description": "A random team",
"privacy": "secret",
"url": "https://api.github.com/teams/820406",
"html_url": "https://github.com/orgs/github-api-test-org/teams/core-developers",
"members_url": "https://api.github.com/teams/820406/members{/member}",
"repositories_url": "https://api.github.com/teams/820406/repos",
"permission": "pull"
},
{
"name": "dummy-team",
"id": 3451996,
"node_id": "MDQ6VGVhbTM0NTE5OTY=",
"slug": "dummy-team",
"description": "Updated by API TestModified",
"privacy": "closed",
"url": "https://api.github.com/teams/3451996",
"html_url": "https://github.com/orgs/github-api-test-org/teams/dummy-team",
"members_url": "https://api.github.com/teams/3451996/members{/member}",
"repositories_url": "https://api.github.com/teams/3451996/repos",
"permission": "pull"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
[
{
"name": "Owners",
"id": 820404,
"node_id": "MDQ6VGVhbTgyMDQwNA==",
"slug": "owners",
"description": null,
"privacy": "secret",
"url": "https://api.github.com/teams/820404",
"html_url": "https://github.com/orgs/github-api-test-org/teams/owners",
"members_url": "https://api.github.com/teams/820404/members{/member}",
"repositories_url": "https://api.github.com/teams/820404/repos",
"permission": "admin"
},
{
"name": "Core Developers",
"id": 820406,
"node_id": "MDQ6VGVhbTgyMDQwNg==",
"slug": "core-developers",
"description": "A random team",
"privacy": "secret",
"url": "https://api.github.com/teams/820406",
"html_url": "https://github.com/orgs/github-api-test-org/teams/core-developers",
"members_url": "https://api.github.com/teams/820406/members{/member}",
"repositories_url": "https://api.github.com/teams/820406/repos",
"permission": "pull"
},
{
"name": "dummy-team",
"id": 3451996,
"node_id": "MDQ6VGVhbTM0NTE5OTY=",
"slug": "dummy-team",
"description": "Updated by API Test",
"privacy": "closed",
"url": "https://api.github.com/teams/3451996",
"html_url": "https://github.com/orgs/github-api-test-org/teams/dummy-team",
"members_url": "https://api.github.com/teams/3451996/members{/member}",
"repositories_url": "https://api.github.com/teams/3451996/repos",
"permission": "pull"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
[
{
"name": "Owners",
"id": 820404,
"node_id": "MDQ6VGVhbTgyMDQwNA==",
"slug": "owners",
"description": null,
"privacy": "secret",
"url": "https://api.github.com/teams/820404",
"html_url": "https://github.com/orgs/github-api-test-org/teams/owners",
"members_url": "https://api.github.com/teams/820404/members{/member}",
"repositories_url": "https://api.github.com/teams/820404/repos",
"permission": "admin"
},
{
"name": "Core Developers",
"id": 820406,
"node_id": "MDQ6VGVhbTgyMDQwNg==",
"slug": "core-developers",
"description": "A random team",
"privacy": "secret",
"url": "https://api.github.com/teams/820406",
"html_url": "https://github.com/orgs/github-api-test-org/teams/core-developers",
"members_url": "https://api.github.com/teams/820406/members{/member}",
"repositories_url": "https://api.github.com/teams/820406/repos",
"permission": "pull"
},
{
"name": "dummy-team",
"id": 3451996,
"node_id": "MDQ6VGVhbTM0NTE5OTY=",
"slug": "dummy-team",
"description": "Updated by API TestModified",
"privacy": "closed",
"url": "https://api.github.com/teams/3451996",
"html_url": "https://github.com/orgs/github-api-test-org/teams/dummy-team",
"members_url": "https://api.github.com/teams/3451996/members{/member}",
"repositories_url": "https://api.github.com/teams/3451996/repos",
"permission": "pull"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "dummy-team",
"id": 3451996,
"node_id": "MDQ6VGVhbTM0NTE5OTY=",
"slug": "dummy-team",
"description": "Updated by API TestModified",
"privacy": "closed",
"url": "https://api.github.com/teams/3451996",
"html_url": "https://github.com/orgs/github-api-test-org/teams/dummy-team",
"members_url": "https://api.github.com/teams/3451996/members{/member}",
"repositories_url": "https://api.github.com/teams/3451996/repos",
"permission": "pull",
"created_at": "2019-10-03T21:46:12Z",
"updated_at": "2019-10-03T21:51:11Z",
"members_count": 1,
"repos_count": 0,
"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": 9,
"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"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "dummy-team",
"id": 3451996,
"node_id": "MDQ6VGVhbTM0NTE5OTY=",
"slug": "dummy-team",
"description": "Updated by API Test",
"privacy": "closed",
"url": "https://api.github.com/teams/3451996",
"html_url": "https://github.com/orgs/github-api-test-org/teams/dummy-team",
"members_url": "https://api.github.com/teams/3451996/members{/member}",
"repositories_url": "https://api.github.com/teams/3451996/repos",
"permission": "pull",
"created_at": "2019-10-03T21:46:12Z",
"updated_at": "2019-10-03T21:51:10Z",
"members_count": 1,
"repos_count": 0,
"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": 9,
"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"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"login": "bitwiseman",
"id": 1958953,
"node_id": "MDQ6VXNlcjE5NTg5NTM=",
"avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/bitwiseman",
"html_url": "https://github.com/bitwiseman",
"followers_url": "https://api.github.com/users/bitwiseman/followers",
"following_url": "https://api.github.com/users/bitwiseman/following{/other_user}",
"gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}",
"starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions",
"organizations_url": "https://api.github.com/users/bitwiseman/orgs",
"repos_url": "https://api.github.com/users/bitwiseman/repos",
"events_url": "https://api.github.com/users/bitwiseman/events{/privacy}",
"received_events_url": "https://api.github.com/users/bitwiseman/received_events",
"type": "User",
"site_admin": false,
"name": "Liam Newman",
"company": "Cloudbees, Inc.",
"blog": "",
"location": "Seattle, WA, USA",
"email": "bitwiseman@gmail.com",
"hireable": null,
"bio": "https://twitter.com/bitwiseman",
"public_repos": 168,
"public_gists": 4,
"followers": 136,
"following": 9,
"created_at": "2012-07-11T20:38:33Z",
"updated_at": "2019-09-24T19:32:29Z",
"private_gists": 7,
"total_private_repos": 9,
"owned_private_repos": 0,
"disk_usage": 33697,
"collaborators": 0,
"two_factor_authentication": true,
"plan": {
"name": "free",
"space": 976562499,
"collaborators": 0,
"private_repos": 10000
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"id": "37477eb5-c7c7-4246-b912-6d066ebcb09c",
"name": "orgs_github-api-test-org",
"request": {
"url": "/orgs/github-api-test-org",
"method": "GET"
},
"response": {
"status": 200,
"bodyFileName": "orgs_github-api-test-org-37477eb5-c7c7-4246-b912-6d066ebcb09c.json",
"headers": {
"Date": "Thu, 03 Oct 2019 21:51:10 GMT",
"Content-Type": "application/json; charset=utf-8",
"Server": "GitHub.com",
"Status": "200 OK",
"X-RateLimit-Limit": "5000",
"X-RateLimit-Remaining": "4950",
"X-RateLimit-Reset": "1570141865",
"Cache-Control": "private, max-age=60, s-maxage=60",
"Vary": [
"Accept, Authorization, Cookie, X-GitHub-OTP",
"Accept-Encoding"
],
"ETag": "W/\"d36965e157281b2a309c39e4c2343a55\"",
"Last-Modified": "Mon, 20 Apr 2015 00:42:30 GMT",
"X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
"X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org",
"X-GitHub-Media-Type": "unknown, github.v3",
"Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
"Access-Control-Allow-Origin": "*",
"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": "CD3D:6B2E:176196E:1B9D60F:5D966D4D"
}
},
"uuid": "37477eb5-c7c7-4246-b912-6d066ebcb09c",
"persistent": true,
"insertionIndex": 2
}
Loading