INNER CODE UNIT · Go

TestInitProvider

dikhan/terraform-provider-openapi · main_test.go:12

func TestInitProvider(t *testing.T) {
	Convey("Given a valid binary name and the OTF_VAR pointing at a valid OpenAPI document", t, func() {
		binaryName := "terraform-provider-openapi"
		file, err := ioutil.TempFile("", "openapi.yaml")
		if err != nil {
			log.Fatal(err)
		}
		file.Write([]byte(`swagger: "2.0"
paths:
  /v1/cdns:`))
		os.Setenv("OTF_VAR_openapi_SWAGGER_URL", file.Name())
		Convey("When initProvider method is called", func() {
			providerName, err := initProvider(binaryName)
			Convey("Then the error returned should be nil", func() {
				So(err, ShouldBeNil)
			})
			Convey("And then the provider returned should not be nil", func() {
				So(providerName, ShouldNotBeNil)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…