Improve code coverage for PM File Converter (Go)
[nonrtric/plt/ranpm.git] / pm-file-converter / common / utils / utils_test.go
diff --git a/pm-file-converter/common/utils/utils_test.go b/pm-file-converter/common/utils/utils_test.go
new file mode 100644 (file)
index 0000000..2cf3f1f
--- /dev/null
@@ -0,0 +1,30 @@
+package utils
+
+import (
+       "github.com/stretchr/testify/assert"
+       "testing"
+)
+
+func TestSend_http_request(t *testing.T) {
+       type testCase struct {
+               Name string
+
+               Json    []byte
+               Method  string
+               Url     string
+               Retry   bool
+               UseAuth bool
+
+               ExpectedBool bool
+       }
+
+       validate := func(t *testing.T, tc *testCase) {
+               t.Run(tc.Name, func(t *testing.T) {
+                       actualBool := Send_http_request(tc.Json, tc.Method, tc.Url, tc.Retry, tc.UseAuth)
+
+                       assert.Equal(t, tc.ExpectedBool, actualBool)
+               })
+       }
+
+       validate(t, &testCase{})
+}