mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-22 10:15:35 +01:00
bug fix
This commit is contained in:
parent
3038790faa
commit
b9833990c4
@ -22,6 +22,7 @@ import (
|
||||
|
||||
"github.com/astaxie/beego/orm"
|
||||
//"github.com/vmware/harbor/src/common/config"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/vmware/harbor/src/common/models"
|
||||
"github.com/vmware/harbor/src/common/utils"
|
||||
"github.com/vmware/harbor/src/common/utils/log"
|
||||
@ -402,6 +403,10 @@ func TestGetUser(t *testing.T) {
|
||||
if currentUser.Email != "tester01@vmware.com" {
|
||||
t.Errorf("the user's email does not match, expected: tester01@vmware.com, actual: %s", currentUser.Email)
|
||||
}
|
||||
|
||||
queryUser = models.User{}
|
||||
_, err = GetUser(queryUser)
|
||||
assert.NotNil(t, err)
|
||||
}
|
||||
|
||||
func TestListUsers(t *testing.T) {
|
||||
|
@ -60,6 +60,10 @@ func GetUser(query models.User) (*models.User, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
if n > 1 {
|
||||
return nil, fmt.Errorf("got more than one user when executing: %s param: %v", sql, queryParam)
|
||||
}
|
||||
|
||||
return &u[0], nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user