Test: WebDAV model

This commit is contained in:
HFO4
2020-02-21 11:32:59 +08:00
parent 5363b90167
commit 9b3f5b0efd
5 changed files with 87 additions and 2 deletions

View File

@@ -82,3 +82,19 @@ func TestUser_WebAuthnName(t *testing.T) {
asserts.Equal("abslant@foxmail.com", name)
}
}
func TestUser_RemoveAuthn(t *testing.T) {
asserts := assert.New(t)
user := User{
Model: gorm.Model{ID: 1},
Authn: `[{"ID":"123","PublicKey":"+4sg1vYcjg/+=","AttestationType":"packed","Authenticator":{"AAGUID":"+lg==","SignCount":0,"CloneWarning":false}}]`,
}
{
mock.ExpectBegin()
mock.ExpectExec("UPDATE(.+)").
WillReturnResult(sqlmock.NewResult(1, 1))
mock.ExpectCommit()
user.RemoveAuthn("123")
asserts.NoError(mock.ExpectationsWereMet())
}
}