package config
import (
+ "encoding/json"
"io/ioutil"
"net/http"
"testing"
StatusCode: http.StatusCreated,
}, nil)
+ schemaString := `{
+ "type": "object",
+ "properties": {},
+ "additionalProperties": false
+ }`
+ var schemaObj interface{}
+ json.Unmarshal([]byte(schemaString), &schemaObj)
+
type1 := TypeDefinition{
- Id: "Type1",
+ Identity: "Type1",
+ TypeSchema: schemaObj,
}
types := []TypeDefinition{type1}
assertions.Equal("http", actualRequest.URL.Scheme)
assertions.Equal("localhost:9990", actualRequest.URL.Host)
assertions.Equal("/data-producer/v1/info-types/Type1", actualRequest.URL.Path)
- assertions.Equal("application/json; charset=utf-8", actualRequest.Header.Get("Content-Type"))
+ assertions.Equal("application/json", actualRequest.Header.Get("Content-Type"))
body, _ := ioutil.ReadAll(actualRequest.Body)
- expectedBody := []byte(`{"info_job_data_schema": {"type": "object","properties": {},"additionalProperties": false}}`)
+ expectedBody := []byte(`{"info_job_data_schema": {"additionalProperties":false,"properties":{},"type":"object"}}`)
assertions.Equal(expectedBody, body)
clientMock.AssertNumberOfCalls(t, "Do", 1)
}
assertions.Equal("http", actualRequest.URL.Scheme)
assertions.Equal("localhost:9990", actualRequest.URL.Host)
assertions.Equal("/data-producer/v1/info-producers/Producer1", actualRequest.URL.Path)
- assertions.Equal("application/json; charset=utf-8", actualRequest.Header.Get("Content-Type"))
+ assertions.Equal("application/json", actualRequest.Header.Get("Content-Type"))
body, _ := ioutil.ReadAll(actualRequest.Body)
expectedBody := []byte(`{"info_producer_supervision_callback_url":"supervisionCallbackUrl","supported_info_types":["type1"],"info_job_callback_url":"jobCallbackUrl"}`)
assertions.Equal(expectedBody, body)