Added test for uid when creating a new team

This commit is contained in:
kolaente 2019-05-25 10:29:14 +02:00
parent 6627c074bd
commit b7918a694e
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
3 changed files with 4 additions and 2 deletions

View File

@ -24,7 +24,7 @@ import (
type team20190525101422 struct {
ID int64 `xorm:"int(11) autoincr not null unique pk"`
UID string `xorm:"varchar(32) not null default ''"`
UID string `xorm:"varchar(32) null"`
Name string `xorm:"varchar(250) not null"`
Description string `xorm:"varchar(250)"`
CreatedByID int64 `xorm:"int(11) not null INDEX"`

View File

@ -23,7 +23,7 @@ type Team struct {
// The unique, numeric id of this team.
ID int64 `xorm:"int(11) autoincr not null unique pk" json:"id" param:"team"`
// The unique uuid for this team. Used to give a team access to things.
UID string `xorm:"varchar(32) not null" json:"uid"`
UID string `xorm:"varchar(32) null" json:"uid"`
// The name of this team.
Name string `xorm:"varchar(250) not null" json:"name" valid:"required,runelength(5|250)" minLength:"5" maxLength:"250"`
// The team's description.

View File

@ -38,6 +38,8 @@ func TestTeam_Create(t *testing.T) {
assert.True(t, allowed)
err = dummyteam.Create(&doer)
assert.NoError(t, err)
// Check the uid was created successfully
assert.NotEqual(t, "", dummyteam.UID)
// Check if it was inserted and we're admin
tm := Team{ID: dummyteam.ID}