flamingo.me/flamingo-commerce/v3@v3.11.0/test/integrationtest/moduletest/product_test.go (about)

     1  //go:build integration
     2  // +build integration
     3  
     4  package moduletest
     5  
     6  import (
     7  	"net/http"
     8  	"testing"
     9  
    10  	"flamingo.me/dingo"
    11  
    12  	"flamingo.me/flamingo-commerce/v3/product"
    13  	"flamingo.me/flamingo-commerce/v3/test/integrationtest"
    14  	"flamingo.me/flamingo/v3/framework/config"
    15  )
    16  
    17  func Test_ProductPage(t *testing.T) {
    18  	info := integrationtest.Bootup(
    19  		[]dingo.Module{
    20  			new(product.Module),
    21  		},
    22  		"",
    23  		config.Map{
    24  			"flamingo.systemendpoint.serviceAddr":  ":0",
    25  			"commerce.product.fakeservice.enabled": true,
    26  		},
    27  	)
    28  	defer info.ShutdownFunc()
    29  
    30  	e := integrationtest.NewHTTPExpect(t, "http://"+info.BaseURL)
    31  	e.GET("/product/fake_configurable/typeconfigurable-product.html").
    32  		Expect().
    33  		Status(http.StatusOK).JSON().Object().Value("RenderContext").Equal("configurable")
    34  
    35  	e.GET("/api/v1/products/fake_simple").
    36  		Expect().
    37  		Status(http.StatusOK).JSON().Object().Value("Success").Boolean().True()
    38  
    39  	e.GET("/api/v1/products/404").
    40  		Expect().
    41  		Status(http.StatusOK).JSON().Object().Value("Success").Boolean().False()
    42  }