Browse Source

Add test case for endpoints/endpoints_config.go

Jackson Tian 7 years ago
parent
commit
09b9e6bd42
2 changed files with 19 additions and 4 deletions
  1. 17 0
      sdk/endpoints/endpoints_config_test.go
  2. 2 4
      sdk/endpoints/mapping_resolver_test.go

+ 17 - 0
sdk/endpoints/endpoints_config_test.go

@@ -0,0 +1,17 @@
+package endpoints
+
+import (
+  "testing"
+
+  "github.com/stretchr/testify/assert"
+)
+
+func Test_getEndpointConfigData(t *testing.T) {
+  r := getEndpointConfigData()
+  d, ok := r.(map[string]interface{})
+  assert.True(t, ok)
+  products := d["products"]
+  p, ok := products.([]interface{})
+  assert.True(t, ok)
+  assert.Equal(t, 47, len(p))
+}

+ 2 - 4
sdk/endpoints/mapping_resolver_test.go

@@ -1,9 +1,9 @@
 package endpoints
 
 import (
-	"fmt"
-	"github.com/stretchr/testify/assert"
 	"testing"
+
+	"github.com/stretchr/testify/assert"
 )
 
 func TestMappingResolver_GetName(t *testing.T) {
@@ -28,6 +28,4 @@ func TestMappingResolver_TryResolve(t *testing.T) {
 	assert.Nil(t, err)
 	assert.Equal(t, "unreachable.aliyuncs.com", endpoint)
 	assert.Equal(t, true, support)
-
-	fmt.Println("finished")
 }