INNER CODE UNIT · Go

Test_getParentIDs

dikhan/terraform-provider-openapi · openapi/common_test.go:254

func Test_getParentIDs(t *testing.T) {
	Convey("Given a nil openAPIResource", t, func() {
		Convey("When getParentIDs is called with a nil SpecResource", func() {
			ss, e := getParentIDs(nil, nil)
			Convey("Then the result returned should be the expected one", func() {
				So(e.Error(), ShouldEqual, "can't get parent ids from an empty SpecResource")
				So(ss, ShouldBeEmpty)
			})
		})
	})

	Convey("Given a SpecResource (with no parent info)", t, func() {
		s := &SpecV2Resource{}
		Convey("When getParentIDs is called with an empty ResourceData", func() {
			ss, err := getParentIDs(s, &schema.ResourceData{})
			Convey("Then the result returned should be the expected one", func() {
				So(err, ShouldBeNil)
				So(ss, ShouldBeEmpty)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…