fix(be): test for register user

This commit is contained in:
Denis Gukov 2022-01-17 01:14:44 +05:00
parent 06900e8160
commit 5860e1378b
3 changed files with 17 additions and 5 deletions

View File

@ -86,13 +86,21 @@ func TestAuthRegister2(t *testing.T) {
t.Fail()
}
store := createStore()
err = store.CreatePlaceholderUser()
if err != nil {
t.Fail()
}
req, _ := http.NewRequest("POST", "/api/auth/register", bytes.NewBuffer(body))
rr := httptest.NewRecorder()
r := Route()
r.Use(func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
context.Set(r, "store", createStore())
context.Set(r, "store", store)
next.ServeHTTP(w, r)
})
})

View File

@ -1,8 +1,10 @@
package db
type Schedule struct {
ID int `db:"id" json:"id"`
ProjectID int `db:"project_id" json:"project_id"`
TemplateID int `db:"template_id" json:"template_id"`
CronFormat string `db:"cron_format" json:"cron_format"`
ID int `db:"id" json:"id"`
ProjectID int `db:"project_id" json:"project_id"`
TemplateID int `db:"template_id" json:"template_id"`
CronFormat string `db:"cron_format" json:"cron_format"`
RepositoryID *int `db:"repository_id" json:"repository_id"`
LastCommitHash *string `db:"last_commit_hash" json:"last_commit_hash"`
}

View File

@ -44,6 +44,8 @@ type Template struct {
ViewID *int `db:"view_id" json:"view_id"`
LastTask *TaskWithTpl `db:"-" json:"last_task"`
Autorun bool `db:"autorun" json:"-"`
}
func (tpl *Template) Validate() error {