diff options
author | 6543 <6543@obermui.de> | 2020-12-18 03:33:32 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-18 11:33:32 +0800 |
commit | e483220ea3c54137cec543842261f99c4696129a (patch) | |
tree | 2f81f173315b8ebe92403290977c09bfc32bf754 /integrations | |
parent | 27edc1aa19afb043a497a7dc628afa420cb1de55 (diff) | |
download | gitea-e483220ea3c54137cec543842261f99c4696129a.tar.gz gitea-e483220ea3c54137cec543842261f99c4696129a.zip |
[Refactor] CombinedStatus and CommitStatus related functions & structs (#14026)
* RM unused struct
* rename (*CommitStatus) loadRepo() -> loadAttributes()
* move ToCommitStatus into its own file
* use CommitStatusState instead of StatusState
* move CombinedStatus convertion into convert package
* let models.GetLatestCommitStatus use repoID direct and accept ListOptions
* update swagger docs
* fix tests
* Fix swagger docs
* rm page
* fix swagger docs!!!
* return json null
* always return json
* rename api.Status to api.CommitStatus
* fix swagger docs
* sec swagger fix
Diffstat (limited to 'integrations')
-rw-r--r-- | integrations/pull_status_test.go | 2 | ||||
-rw-r--r-- | integrations/repo_commits_test.go | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/integrations/pull_status_test.go b/integrations/pull_status_test.go index 0002784792..fc4c7ca33d 100644 --- a/integrations/pull_status_test.go +++ b/integrations/pull_status_test.go @@ -70,7 +70,7 @@ func TestPullCreate_CommitStatus(t *testing.T) { token := getTokenForLoggedInUser(t, session) req = NewRequestWithJSON(t, "POST", fmt.Sprintf("/api/v1/repos/user1/repo1/statuses/%s?token=%s", commitID, token), api.CreateStatusOption{ - State: api.StatusState(status), + State: status, TargetURL: "http://test.ci/", Description: "", Context: "testci", diff --git a/integrations/repo_commits_test.go b/integrations/repo_commits_test.go index 2aa0260a16..f341f8026a 100644 --- a/integrations/repo_commits_test.go +++ b/integrations/repo_commits_test.go @@ -51,7 +51,7 @@ func doTestRepoCommitWithStatus(t *testing.T, state string, classes ...string) { // Call API to add status for commit req = NewRequestWithJSON(t, "POST", "/api/v1/repos/user2/repo1/statuses/"+path.Base(commitURL)+"?token="+token, api.CreateStatusOption{ - State: api.StatusState(state), + State: api.CommitStatusState(state), TargetURL: "http://test.ci/", Description: "", Context: "testci", @@ -83,11 +83,11 @@ func doTestRepoCommitWithStatus(t *testing.T, state string, classes ...string) { func testRepoCommitsWithStatus(t *testing.T, resp *httptest.ResponseRecorder, state string) { decoder := json.NewDecoder(resp.Body) - statuses := []*api.Status{} + statuses := []*api.CommitStatus{} assert.NoError(t, decoder.Decode(&statuses)) assert.Len(t, statuses, 1) for _, s := range statuses { - assert.Equal(t, api.StatusState(state), s.State) + assert.Equal(t, api.CommitStatusState(state), s.State) assert.Equal(t, setting.AppURL+"api/v1/repos/user2/repo1/statuses/65f1bf27bc3bf70f64657658635e66094edbcb4d", s.URL) assert.Equal(t, "http://test.ci/", s.TargetURL) assert.Equal(t, "", s.Description) |