mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-09 08:07:40 +00:00
enable linter testifylint on v7 (#4572)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4572 Co-authored-by: TheFox0x7 <thefox0x7@gmail.com> Co-committed-by: TheFox0x7 <thefox0x7@gmail.com>
This commit is contained in:
parent
c47bdf436b
commit
072dd9f8bc
494 changed files with 4897 additions and 4554 deletions
|
@ -19,6 +19,7 @@ import (
|
|||
"code.gitea.io/gitea/tests"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestViewDeployKeysNoLogin(t *testing.T) {
|
||||
|
@ -133,7 +134,7 @@ func TestCreateUserKey(t *testing.T) {
|
|||
var newPublicKey api.PublicKey
|
||||
DecodeJSON(t, resp, &newPublicKey)
|
||||
fingerprint, err := asymkey_model.CalcFingerprint(rawKeyBody.Key)
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
unittest.AssertExistsAndLoadBean(t, &asymkey_model.PublicKey{
|
||||
ID: newPublicKey.ID,
|
||||
OwnerID: user.ID,
|
||||
|
@ -168,7 +169,7 @@ func TestCreateUserKey(t *testing.T) {
|
|||
resp = MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
DecodeJSON(t, resp, &fingerprintPublicKeys)
|
||||
assert.Len(t, fingerprintPublicKeys, 0)
|
||||
assert.Empty(t, fingerprintPublicKeys)
|
||||
|
||||
// Fail searching for wrong users key
|
||||
req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/users/%s/keys?fingerprint=%s", "user2", newPublicKey.Fingerprint)).
|
||||
|
@ -176,7 +177,7 @@ func TestCreateUserKey(t *testing.T) {
|
|||
resp = MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
DecodeJSON(t, resp, &fingerprintPublicKeys)
|
||||
assert.Len(t, fingerprintPublicKeys, 0)
|
||||
assert.Empty(t, fingerprintPublicKeys)
|
||||
|
||||
// Now login as user 2
|
||||
session2 := loginUser(t, "user2")
|
||||
|
@ -208,5 +209,5 @@ func TestCreateUserKey(t *testing.T) {
|
|||
resp = MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
DecodeJSON(t, resp, &fingerprintPublicKeys)
|
||||
assert.Len(t, fingerprintPublicKeys, 0)
|
||||
assert.Empty(t, fingerprintPublicKeys)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue