INNER CODE UNIT · Go
TestGetParentIDsAndResourcePath
dikhan/terraform-provider-openapi · openapi/common_test.go:185
func TestGetParentIDsAndResourcePath(t *testing.T) {
Convey("Given an nil openapi resource (internal getParentIDs call fails for some reason)", t, func() {
Convey("When getParentIDsAndResourcePath is called", func() {
parentIDs, resourcePath, err := getParentIDsAndResourcePath(nil, nil)
Convey("Then the result returned should be the expected one", func() {
So(err.Error(), ShouldEqual, "can't get parent ids from an empty SpecResource")
So(parentIDs, ShouldBeEmpty)
So(resourcePath, ShouldBeEmpty)
})
})
})
Convey("Given an empty openapi resource (internal getResourcePath() call fails for some reason)", t, func() {
someFirewallProperty := newStringSchemaDefinitionPropertyWithDefaults("some_string_prop", "", true, false, "some value")
parentProperty := newStringSchemaDefinitionPropertyWithDefaults("cdns_v1_id", "", true, false, "parentPropertyID")
testSchema := newTestSchema(someFirewallProperty, parentProperty)
resourceData := testSchema.getResourceData(t)