func TestParseWithPartialRequest(t *testing.T) {
	res := dh.RequestResource{}

	jsonString := `{ "url": "http://example.com/some/resource" }`
	incomingJSON := strings.NewReader(jsonString)

	expectedIncoming := api.IncomingRequest{URL: "http://example.com/some/resource"}

	r, _ := res.DecodeInputRequest(incomingJSON)
	if *r != expectedIncoming {
		t.Errorf(`DecodeInputRequest('%s') = %q want %q`, jsonString, r, expectedIncoming)
	}
}
func TestParseCompleteRequest(t *testing.T) {
	res := dh.RequestResource{}

	jsonString := `{ "url": "http://example.com/some/resource", "checksum": "abcde", "checksum_type": "abc", "callback": "http://example.com/callback" }`
	incomingJSON := strings.NewReader(jsonString)

	expectedIncoming := api.IncomingRequest{
		URL:          "http://example.com/some/resource",
		Checksum:     "abcde",
		ChecksumType: "abc",
		Callback:     "http://example.com/callback"}

	r, _ := res.DecodeInputRequest(incomingJSON)
	if *r != expectedIncoming {
		t.Errorf(`DecodeInputRequest('%s') = %q want %q`, jsonString, r, expectedIncoming)
	}
}
func TestGetRequestURL(t *testing.T) {
	requestID := "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"

	expectedURL, _ := url.Parse("/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")
	res := dh.RequestResource{}
	router := mux.NewRouter()

	res.RegisterRoutes(router)

	u, err := res.GetRequestURL(requestID)

	if err != nil {
		t.Error(err)
	}

	if *u != *expectedURL {
		t.Errorf(`GetRequestURL('%s') = %q want %q`, requestID, u, expectedURL)
	}
}