Skip to content

Commit

Permalink
modified tcs for bad request
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhishekism9450 committed Jan 12, 2023
1 parent a11774d commit 42c37d4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ func TestGetResponse(t *testing.T) {
StatusCode: http.StatusBadRequest,
Body: ioutil.NopCloser(strings.NewReader(
`{"api_version": "3.1", "code": 400, "kind": "error", "message_list":
[{"message": "This field may not be blank."}], "state": "ERROR"}`)),
[{"message": "bad Request"}], "state": "ERROR"}`)),
}

err := CheckResponse(res)
Expand All @@ -292,8 +292,8 @@ func TestGetResponse(t *testing.T) {
t.Fatal("Expected error response.")
}

if !strings.Contains(fmt.Sprint(err), "This field may not be blank.") {
t.Errorf("error = %#v, expected %#v", err, "This field may not be blank.")
if !strings.Contains(fmt.Sprint(err), "bad Request") {
t.Errorf("error = %#v, expected %#v", err, "bad Request")
}
}

Expand All @@ -303,16 +303,16 @@ func TestCheckResponse(t *testing.T) {
StatusCode: http.StatusBadRequest,
Body: ioutil.NopCloser(strings.NewReader(
`{"api_version": "3.1", "code": 400, "kind": "error", "message_list":
[{"message": "This field may not be blank."}], "state": "ERROR"}`)),
[{"message": "bad Request"}], "state": "ERROR"}`)),
}
err := CheckResponse(res)

if err == nil {
t.Fatalf("Expected error response.")
}

if !strings.Contains(fmt.Sprint(err), "This field may not be blank.") {
t.Errorf("error = %#v, expected %#v", err, "This field may not be blank.")
if !strings.Contains(fmt.Sprint(err), "bad Request") {
t.Errorf("error = %#v, expected %#v", err, "bad Request")
}
}

Expand Down

0 comments on commit 42c37d4

Please sign in to comment.