From 4f5b3590a3ff58d068b797ef6850c83f46d84405 Mon Sep 17 00:00:00 2001 From: Marek Aufart Date: Mon, 18 Dec 2023 11:10:12 +0100 Subject: [PATCH] Create questionnaire by test itself Signed-off-by: Marek Aufart --- test/api/assessment/api_test.go | 7 +++++++ test/api/assessment/samples.go | 1 - 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/test/api/assessment/api_test.go b/test/api/assessment/api_test.go index 16e719a7b..33815dcfe 100644 --- a/test/api/assessment/api_test.go +++ b/test/api/assessment/api_test.go @@ -5,12 +5,18 @@ import ( "testing" "github.com/konveyor/tackle2-hub/api" + "github.com/konveyor/tackle2-hub/test/api/questionnaire" "github.com/konveyor/tackle2-hub/test/assert" ) func TestAssessmentCRUD(t *testing.T) { for _, r := range Samples { t.Run(fmt.Sprintf("%s for application %s", r.Questionnaire.Name, r.Application.Name), func(t *testing.T) { + // Prepare questionnaire + questionnaire := questionnaire.Questionnaire1 + assert.Must(t, RichClient.Questionnaire.Create(&questionnaire)) + r.Questionnaire.ID = questionnaire.ID + // Create via parent resource. if r.Application.Name != "" { app := api.Application{Name: r.Application.Name} @@ -78,6 +84,7 @@ func TestAssessmentCRUD(t *testing.T) { } assert.Must(t, RichClient.Application.Delete(r.Application.ID)) + assert.Must(t, RichClient.Questionnaire.Delete(r.Questionnaire.ID)) }) } } diff --git a/test/api/assessment/samples.go b/test/api/assessment/samples.go index 90a09a0cb..1a1ec5493 100644 --- a/test/api/assessment/samples.go +++ b/test/api/assessment/samples.go @@ -15,7 +15,6 @@ var ( Name: application.Minimal.Name, }, Questionnaire: api.Ref{ - ID: 1, Name: questionnaire.Questionnaire1.Name, }, Sections: []assessment.Section{