Skip to content

Instantly share code, notes, and snippets.

@pranavgore09
Created March 13, 2018 11:21
Show Gist options
  • Select an option

  • Save pranavgore09/7d428b0c5bae7ddcc537c02e216bb41f to your computer and use it in GitHub Desktop.

Select an option

Save pranavgore09/7d428b0c5bae7ddcc537c02e216bb41f to your computer and use it in GitHub Desktop.
test case for `Check that already imported space template upon new import doesn't change the types of it's fields.` mentioned in https://github.com/fabric8-services/fabric8-wit/pull/1148
t.Run("import existing template with WIT field type changes", func(t *testing.T) {
// Create fresh template
spaceTemplateID := uuid.NewV4()
witID := uuid.NewV4()
wiltID := uuid.NewV4()
witgID := uuid.NewV4()
oldTempl := getValidTestTemplateParsed(t, spaceTemplateID, witID, wiltID, witgID)
oldTempl.Template.Name = "old name for space template " + spaceTemplateID.String()
_, err := s.importerRepo.Import(s.Ctx, oldTempl)
require.NoError(t, err)
// Import it once more but this time with changes
templ := getValidTestTemplateParsed(t, spaceTemplateID, witID, wiltID, witgID)
templ.WITs[0].Fields["title"] = workitem.FieldDefinition{
Label: "Title",
Description: "The title of the bug",
Required: true,
Type: workitem.SimpleType{
Kind: workitem.KindInteger,
},
}
// when
_, err = s.importerRepo.Import(s.Ctx, templ)
// then
require.Error(t, err)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment