--- /dev/null
+package httpclient
+
+import (
+ "encoding/json"
+ "log"
+ "testing"
+
+ "net/http"
+ "net/http/httptest"
+)
+
+var (
+ server *httptest.Server
+ mockRemoteAddr string
+)
+
+func init() {
+ server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ log.Printf("Test Handler")
+
+ w.WriteHeader(http.StatusOK)
+ w.Write([]byte(r.Method))
+ }))
+
+ mockRemoteAddr = server.URL
+}
+
+func TestDoGet(t *testing.T) {
+ resp, err := DoGet(mockRemoteAddr)
+
+ retError(t, err)
+
+ if string(resp) != "GET" {
+ t.Error()
+ }
+}
+
+func TestDoPost(t *testing.T) {
+ msg := make(map[string]interface{})
+ msg["testKey"] = "test"
+
+ msgBytes, err := json.Marshal(msg)
+ retError(t, err)
+
+ resp, err := DoPost(mockRemoteAddr, msgBytes)
+
+ retError(t, err)
+
+ if string(resp) != "POST" {
+ t.Error()
+ }
+}
+
+func TestDoDelete(t *testing.T) {
+ resp, err := DoDelete(mockRemoteAddr)
+
+ retError(t, err)
+
+ if string(resp) != "DELETE" {
+ t.Error()
+ }
+
+}
+
+func retError(t *testing.T, err error) {
+ t.Helper()
+
+ if err != nil {
+ t.Error(err.Error())
+ }
+}