Skip to content

Commit

Permalink
Create questionnaire by test itself
Browse files Browse the repository at this point in the history
Signed-off-by: Marek Aufart <[email protected]>
  • Loading branch information
aufi committed Dec 18, 2023
1 parent 86e2b95 commit 4f5b359
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 7 additions & 0 deletions test/api/assessment/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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))
})
}
}
1 change: 0 additions & 1 deletion test/api/assessment/samples.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ var (
Name: application.Minimal.Name,
},
Questionnaire: api.Ref{
ID: 1,
Name: questionnaire.Questionnaire1.Name,
},
Sections: []assessment.Section{
Expand Down

0 comments on commit 4f5b359

Please sign in to comment.