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

Add name field for org api #21270

Merged
merged 8 commits into from
Sep 29, 2022
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
Use Name in tests.
  • Loading branch information
KN4CK3R committed Sep 26, 2022
commit b79a66c412e479e63f8d6e02b5064c2fcfa49a34
2 changes: 1 addition & 1 deletion modules/structs/org.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ package structs
type Organization struct {
ID int64 `json:"id"`
Name string `json:"name"`
UserName string `json:"username"`
UserName string `json:"username"` // deprecated
FullName string `json:"full_name"`
AvatarURL string `json:"avatar_url"`
Description string `json:"description"`
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/api_admin_org_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/api_org_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/api_user_orgs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestUserOrgs(t *testing.T) {
assert.Equal(t, []*api.Organization{
{
ID: 17,
UserName: user17.Name,
Name: user17.Name,
FullName: user17.FullName,
AvatarURL: user17.AvatarLink(),
Description: "",
Expand All @@ -42,7 +42,7 @@ func TestUserOrgs(t *testing.T) {
},
{
ID: 3,
UserName: user3.Name,
Name: user3.Name,
FullName: user3.FullName,
AvatarURL: user3.AvatarLink(),
Description: "",
Expand Down Expand Up @@ -99,7 +99,7 @@ func TestMyOrgs(t *testing.T) {
assert.Equal(t, []*api.Organization{
{
ID: 17,
UserName: user17.Name,
Name: user17.Name,
FullName: user17.FullName,
AvatarURL: user17.AvatarLink(),
Description: "",
Expand All @@ -109,7 +109,7 @@ func TestMyOrgs(t *testing.T) {
},
{
ID: 3,
UserName: user3.Name,
Name: user3.Name,
FullName: user3.FullName,
AvatarURL: user3.AvatarLink(),
Description: "",
Expand Down