db: add tests for users (#6116)

* Add new methods

* Use Users.Create to replace previous hack

* Reduce side effect

* Do not clear tables when test failed

* test_users_Authenticate

* Rename constant

* test_users_Create

* test_users_GetByEmail

* test_users_GetByID

* test_users_GetByUsername
This commit is contained in:
ᴜɴᴋɴᴡᴏɴ
2020-04-18 12:07:30 +08:00
committed by GitHub
parent fa497b1633
commit 9d64d222a8
25 changed files with 506 additions and 112 deletions

View File

@@ -138,7 +138,7 @@ func ExploreUsers(c *context.Context) {
c.Data["PageIsExploreUsers"] = true
RenderUserSearch(c, &UserSearchOptions{
Type: db.USER_TYPE_INDIVIDUAL,
Type: db.UserIndividual,
Counter: db.CountUsers,
Ranger: db.ListUsers,
PageSize: conf.UI.ExplorePagingNum,
@@ -153,7 +153,7 @@ func ExploreOrganizations(c *context.Context) {
c.Data["PageIsExploreOrganizations"] = true
RenderUserSearch(c, &UserSearchOptions{
Type: db.USER_TYPE_ORGANIZATION,
Type: db.UserOrganization,
Counter: db.CountOrganizations,
Ranger: db.Organizations,
PageSize: conf.UI.ExplorePagingNum,