diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2022-06-12 23:51:54 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-12 23:51:54 +0800 |
commit | 110fc57cbcf293c19ed7017d8ea528b4bbbd7396 (patch) | |
tree | b36eb2ee0e3f8417a35ad095e25880b778ded0ba /models/commit_status_test.go | |
parent | a9dc9b06e4a4106ec8315fe7b2922efa440ca199 (diff) | |
download | gitea-110fc57cbcf293c19ed7017d8ea528b4bbbd7396.tar.gz gitea-110fc57cbcf293c19ed7017d8ea528b4bbbd7396.zip |
Move some code into models/git (#19879)
* Move access and repo permission to models/perm/access
* fix test
* Move some git related files into sub package models/git
* Fix build
* fix git test
* move lfs to sub package
* move more git related functions to models/git
* Move functions sequence
* Some improvements per @KN4CK3R and @delvh
Diffstat (limited to 'models/commit_status_test.go')
-rw-r--r-- | models/commit_status_test.go | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/models/commit_status_test.go b/models/commit_status_test.go deleted file mode 100644 index bb9e375072..0000000000 --- a/models/commit_status_test.go +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2017 Gitea. All rights reserved. -// Use of this source code is governed by a MIT-style -// license that can be found in the LICENSE file. - -package models - -import ( - "testing" - - "code.gitea.io/gitea/models/db" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/models/unittest" - "code.gitea.io/gitea/modules/structs" - - "github.com/stretchr/testify/assert" -) - -func TestGetCommitStatuses(t *testing.T) { - assert.NoError(t, unittest.PrepareTestDatabase()) - - repo1 := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1}).(*repo_model.Repository) - - sha1 := "1234123412341234123412341234123412341234" - - statuses, maxResults, err := GetCommitStatuses(repo1, sha1, &CommitStatusOptions{ListOptions: db.ListOptions{Page: 1, PageSize: 50}}) - assert.NoError(t, err) - assert.Equal(t, int(maxResults), 5) - assert.Len(t, statuses, 5) - - assert.Equal(t, "ci/awesomeness", statuses[0].Context) - assert.Equal(t, structs.CommitStatusPending, statuses[0].State) - assert.Equal(t, "https://try.gitea.io/api/v1/repos/user2/repo1/statuses/1234123412341234123412341234123412341234", statuses[0].APIURL()) - - assert.Equal(t, "cov/awesomeness", statuses[1].Context) - assert.Equal(t, structs.CommitStatusWarning, statuses[1].State) - assert.Equal(t, "https://try.gitea.io/api/v1/repos/user2/repo1/statuses/1234123412341234123412341234123412341234", statuses[1].APIURL()) - - assert.Equal(t, "cov/awesomeness", statuses[2].Context) - assert.Equal(t, structs.CommitStatusSuccess, statuses[2].State) - assert.Equal(t, "https://try.gitea.io/api/v1/repos/user2/repo1/statuses/1234123412341234123412341234123412341234", statuses[2].APIURL()) - - assert.Equal(t, "ci/awesomeness", statuses[3].Context) - assert.Equal(t, structs.CommitStatusFailure, statuses[3].State) - assert.Equal(t, "https://try.gitea.io/api/v1/repos/user2/repo1/statuses/1234123412341234123412341234123412341234", statuses[3].APIURL()) - - assert.Equal(t, "deploy/awesomeness", statuses[4].Context) - assert.Equal(t, structs.CommitStatusError, statuses[4].State) - assert.Equal(t, "https://try.gitea.io/api/v1/repos/user2/repo1/statuses/1234123412341234123412341234123412341234", statuses[4].APIURL()) -} |