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 api for user to create org #5268

Merged
merged 9 commits into from
Nov 20, 2018
Merged
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
fix tests
  • Loading branch information
lunny committed Nov 11, 2018
commit 4861c5757a90648fea72eac189972d3d61378871
12 changes: 10 additions & 2 deletions integrations/api_org_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ package integrations

import (
"net/http"
"strings"
"testing"

"code.gitea.io/gitea/models"
api "code.gitea.io/sdk/gitea"

"github.com/stretchr/testify/assert"
Expand All @@ -26,8 +28,8 @@ func TestAPIOrg(t *testing.T) {
Website: "https://try.gitea.io",
Location: "Shanghai",
}
req := NewRequestf(t, "POST", "/api/v1/orgs?token="+token, &org)
resp := session.MakeRequest(t, req, http.StatusOK)
req := NewRequestWithJSON(t, "POST", "/api/v1/orgs?token="+token, &org)
resp := session.MakeRequest(t, req, http.StatusCreated)

var apiOrg api.Organization
DecodeJSON(t, resp, &apiOrg)
Expand All @@ -37,4 +39,10 @@ func TestAPIOrg(t *testing.T) {
assert.Equal(t, org.Description, apiOrg.Description)
assert.Equal(t, org.Website, apiOrg.Website)
assert.Equal(t, org.Location, apiOrg.Location)

models.AssertExistsAndLoadBean(t, &models.User{
Name: org.UserName,
LowerName: strings.ToLower(org.UserName),
FullName: org.FullName,
})
}