db: add tests for repos (#6112)

* Add Repos.create method

* Fix repo name error handling

* Fix all compile errors

* Update github.com/go-macaron/captcha to fix http issue

* Add repos tests
This commit is contained in:
ᴜɴᴋɴᴡᴏɴ
2020-04-17 10:14:18 +08:00
committed by GitHub
parent e131a45646
commit fa497b1633
23 changed files with 302 additions and 170 deletions

View File

@@ -55,8 +55,7 @@ func CreateUser(c *context.APIContext, form api.CreateUserOption) {
if err := db.CreateUser(u); err != nil {
if db.IsErrUserAlreadyExist(err) ||
db.IsErrEmailAlreadyUsed(err) ||
db.IsErrNameReserved(err) ||
db.IsErrNamePatternNotAllowed(err) {
db.IsErrNameNotAllowed(err) {
c.ErrorStatus(http.StatusUnprocessableEntity, err)
} else {
c.Error(err, "create user")