diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2019-06-30 15:57:59 +0800 |
---|---|---|
committer | zeripath <art27@cantab.net> | 2019-06-30 08:57:59 +0100 |
commit | ff85dd3e12c05be98d9132de2e629523d096f712 (patch) | |
tree | c0b5d69eef2fd859204437bd8b206e06a7b8a47d /models/commit_status_test.go | |
parent | 1e46eedce721e22e3e1e94eec6e0afccd36147c1 (diff) | |
download | gitea-ff85dd3e12c05be98d9132de2e629523d096f712.tar.gz gitea-ff85dd3e12c05be98d9132de2e629523d096f712.zip |
Add commit statuses reports on pull request view (#6845)
* Add commit statuses reports on pull view
* Add some translations
* improve the UI
* fix fmt
* fix tests
* add a new test git repo to fix tests
* fix bug when headRepo or headBranch missing
* fix tests
* fix tests
* fix consistency
* fix tests
* fix tests
* change the test repo
* fix tests
* fix tests
* fix migration
* keep db size consistency
* fix translation
* change commit hash status table unique index
* remove unused table
* use char instead varchar
* make hashCommitStatusContext private
* split merge section with status check on pull view ui
* fix tests; fix arc-green theme on pull ui
Diffstat (limited to 'models/commit_status_test.go')
-rw-r--r-- | models/commit_status_test.go | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/models/commit_status_test.go b/models/commit_status_test.go new file mode 100644 index 0000000000..78d2370f9d --- /dev/null +++ b/models/commit_status_test.go @@ -0,0 +1,38 @@ +// 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" + + "github.com/stretchr/testify/assert" +) + +func TestGetCommitStatuses(t *testing.T) { + assert.NoError(t, PrepareTestDatabase()) + + repo1 := AssertExistsAndLoadBean(t, &Repository{ID: 1}).(*Repository) + + sha1 := "1234123412341234123412341234123412341234" + + statuses, err := GetCommitStatuses(repo1, sha1, 0) + assert.NoError(t, err) + if assert.Len(t, statuses, 5) { + assert.Equal(t, statuses[0].Context, "ci/awesomeness") + assert.Equal(t, statuses[0].State, CommitStatusPending) + + assert.Equal(t, statuses[1].Context, "cov/awesomeness") + assert.Equal(t, statuses[1].State, CommitStatusWarning) + + assert.Equal(t, statuses[2].Context, "cov/awesomeness") + assert.Equal(t, statuses[2].State, CommitStatusSuccess) + + assert.Equal(t, statuses[3].Context, "ci/awesomeness") + assert.Equal(t, statuses[3].State, CommitStatusFailure) + + assert.Equal(t, statuses[4].Context, "deploy/awesomeness") + assert.Equal(t, statuses[4].State, CommitStatusError) + } +} |