feat(be): merge task environment with template environment

This commit is contained in:
Denis Gukov 2021-11-02 22:44:09 +05:00
parent 4dc9106fe7
commit fa47a24078

View File

@ -47,10 +47,19 @@ func TestPopulateDetails(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
env, err := store.CreateEnvironment(db.Environment{
ProjectID: proj.ID,
JSON: `{"author": "Denis", "comment": "Hello, World!"}`,
})
if err != nil {
t.Fatal(err)
}
tpl, err := store.CreateTemplate(db.Template{ tpl, err := store.CreateTemplate(db.Template{
ProjectID: proj.ID, ProjectID: proj.ID,
RepositoryID: repo.ID, RepositoryID: repo.ID,
InventoryID: inv.ID, InventoryID: inv.ID,
EnvironmentID: &env.ID,
}) })
if err != nil { if err != nil {
@ -62,6 +71,7 @@ func TestPopulateDetails(t *testing.T) {
projectID: proj.ID, projectID: proj.ID,
task: db.Task{ task: db.Task{
TemplateID: tpl.ID, TemplateID: tpl.ID,
Environment: `{"comment": "Just do it!", "time": "2021-11-02"}`,
}, },
} }
@ -69,6 +79,9 @@ func TestPopulateDetails(t *testing.T) {
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
if tsk.environment.JSON != `{"author":"Denis","comment":"Hello, World!","time":"2021-11-02"}` {
t.Fatal(err)
}
} }
func TestTaskGetPlaybookArgs(t *testing.T) { func TestTaskGetPlaybookArgs(t *testing.T) {