mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-07-02 18:00:03 +02: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
|
@ -15,7 +15,7 @@ import (
|
|||
"code.gitea.io/gitea/tests"
|
||||
|
||||
"github.com/pquerna/otp/totp"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestAPITwoFactor(t *testing.T) {
|
||||
|
@ -32,21 +32,21 @@ func TestAPITwoFactor(t *testing.T) {
|
|||
Issuer: "gitea-test",
|
||||
AccountName: user.Name,
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
tfa := &auth_model.TwoFactor{
|
||||
UID: user.ID,
|
||||
}
|
||||
assert.NoError(t, tfa.SetSecret(otpKey.Secret()))
|
||||
require.NoError(t, tfa.SetSecret(otpKey.Secret()))
|
||||
|
||||
assert.NoError(t, auth_model.NewTwoFactor(db.DefaultContext, tfa))
|
||||
require.NoError(t, auth_model.NewTwoFactor(db.DefaultContext, tfa))
|
||||
|
||||
req = NewRequest(t, "GET", "/api/v1/user").
|
||||
AddBasicAuth(user.Name)
|
||||
MakeRequest(t, req, http.StatusUnauthorized)
|
||||
|
||||
passcode, err := totp.GenerateCode(otpKey.Secret(), time.Now())
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
req = NewRequest(t, "GET", "/api/v1/user").
|
||||
AddBasicAuth(user.Name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue