From fa47a240784fd668e3c2d4a5313b4cfa8001ca87 Mon Sep 17 00:00:00 2001 From: Denis Gukov Date: Tue, 2 Nov 2021 22:44:09 +0500 Subject: [PATCH] feat(be): merge task environment with template environment --- api/tasks/runner_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/api/tasks/runner_test.go b/api/tasks/runner_test.go index ed65d618..8b7286e6 100644 --- a/api/tasks/runner_test.go +++ b/api/tasks/runner_test.go @@ -47,10 +47,19 @@ func TestPopulateDetails(t *testing.T) { 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{ ProjectID: proj.ID, RepositoryID: repo.ID, InventoryID: inv.ID, + EnvironmentID: &env.ID, }) if err != nil { @@ -62,6 +71,7 @@ func TestPopulateDetails(t *testing.T) { projectID: proj.ID, task: db.Task{ TemplateID: tpl.ID, + Environment: `{"comment": "Just do it!", "time": "2021-11-02"}`, }, } @@ -69,6 +79,9 @@ func TestPopulateDetails(t *testing.T) { if err != nil { t.Fatal(err) } + if tsk.environment.JSON != `{"author":"Denis","comment":"Hello, World!","time":"2021-11-02"}` { + t.Fatal(err) + } } func TestTaskGetPlaybookArgs(t *testing.T) {