From b7309b8ccb16f6303ae300b755baef9f9713d457 Mon Sep 17 00:00:00 2001 From: KN4CK3R Date: Thu, 29 Sep 2022 05:27:33 +0200 Subject: Add name field for org api (#21270) related #21205 The field `UserName` is not really usefull for an organization. This adds a second `Name` field. The [GitHub API](https://docs.github.com/en/rest/orgs/orgs#get-an-organization) uses `name` too. `UserName` should be deprecated then. --- tests/integration/api_admin_org_test.go | 2 +- tests/integration/api_org_test.go | 6 +++--- tests/integration/api_user_orgs_test.go | 4 ++++ 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/integration/api_admin_org_test.go b/tests/integration/api_admin_org_test.go index 720f6fc6b6..a8770db4ca 100644 --- a/tests/integration/api_admin_org_test.go +++ b/tests/integration/api_admin_org_test.go @@ -37,7 +37,7 @@ func TestAPIAdminOrgCreate(t *testing.T) { var apiOrg api.Organization DecodeJSON(t, resp, &apiOrg) - assert.Equal(t, org.UserName, apiOrg.UserName) + assert.Equal(t, org.UserName, apiOrg.Name) assert.Equal(t, org.FullName, apiOrg.FullName) assert.Equal(t, org.Description, apiOrg.Description) assert.Equal(t, org.Website, apiOrg.Website) diff --git a/tests/integration/api_org_test.go b/tests/integration/api_org_test.go index 4b8c5c97a8..16e53d6b81 100644 --- a/tests/integration/api_org_test.go +++ b/tests/integration/api_org_test.go @@ -38,7 +38,7 @@ func TestAPIOrgCreate(t *testing.T) { var apiOrg api.Organization DecodeJSON(t, resp, &apiOrg) - assert.Equal(t, org.UserName, apiOrg.UserName) + assert.Equal(t, org.UserName, apiOrg.Name) assert.Equal(t, org.FullName, apiOrg.FullName) assert.Equal(t, org.Description, apiOrg.Description) assert.Equal(t, org.Website, apiOrg.Website) @@ -54,7 +54,7 @@ func TestAPIOrgCreate(t *testing.T) { req = NewRequestf(t, "GET", "/api/v1/orgs/%s?token=%s", org.UserName, token) resp = MakeRequest(t, req, http.StatusOK) DecodeJSON(t, resp, &apiOrg) - assert.EqualValues(t, org.UserName, apiOrg.UserName) + assert.EqualValues(t, org.UserName, apiOrg.Name) req = NewRequestf(t, "GET", "/api/v1/orgs/%s/repos?token=%s", org.UserName, token) resp = MakeRequest(t, req, http.StatusOK) @@ -94,7 +94,7 @@ func TestAPIOrgEdit(t *testing.T) { var apiOrg api.Organization DecodeJSON(t, resp, &apiOrg) - assert.Equal(t, "user3", apiOrg.UserName) + assert.Equal(t, "user3", apiOrg.Name) assert.Equal(t, org.FullName, apiOrg.FullName) assert.Equal(t, org.Description, apiOrg.Description) assert.Equal(t, org.Website, apiOrg.Website) diff --git a/tests/integration/api_user_orgs_test.go b/tests/integration/api_user_orgs_test.go index 622dfdcf21..c28bf391eb 100644 --- a/tests/integration/api_user_orgs_test.go +++ b/tests/integration/api_user_orgs_test.go @@ -32,6 +32,7 @@ func TestUserOrgs(t *testing.T) { assert.Equal(t, []*api.Organization{ { ID: 17, + Name: user17.Name, UserName: user17.Name, FullName: user17.FullName, AvatarURL: user17.AvatarLink(), @@ -42,6 +43,7 @@ func TestUserOrgs(t *testing.T) { }, { ID: 3, + Name: user3.Name, UserName: user3.Name, FullName: user3.FullName, AvatarURL: user3.AvatarLink(), @@ -99,6 +101,7 @@ func TestMyOrgs(t *testing.T) { assert.Equal(t, []*api.Organization{ { ID: 17, + Name: user17.Name, UserName: user17.Name, FullName: user17.FullName, AvatarURL: user17.AvatarLink(), @@ -109,6 +112,7 @@ func TestMyOrgs(t *testing.T) { }, { ID: 3, + Name: user3.Name, UserName: user3.Name, FullName: user3.FullName, AvatarURL: user3.AvatarLink(), -- cgit v1.2.3