fixed testing issue

This commit is contained in:
Guo Huang 2016-05-03 10:27:27 -07:00
parent a5b08a8ce7
commit 035ee18ba4

View File

@ -18,8 +18,8 @@ func TestAddPet(t *testing.T) {
t.Errorf("Error while adding pet") t.Errorf("Error while adding pet")
t.Log(err) t.Log(err)
} }
if apiResponse.Response.StatusCode != 200 { if *apiResponse.Response.StatusCode != 200 {
t.Log(apiResponse.Response) t.Log(*apiResponse.Response)
} }
} }
@ -32,8 +32,8 @@ func TestFindPetsByStatusWithMissingParam(t *testing.T) {
t.Errorf("Error while testing TestFindPetsByStatusWithMissingParam") t.Errorf("Error while testing TestFindPetsByStatusWithMissingParam")
t.Log(err) t.Log(err)
} }
if apiResponse.Response.StatusCode != 200 { if *apiResponse.Response.StatusCode != 200 {
t.Log(apiResponse) t.Log(*apiResponse)
} }
} }
@ -52,8 +52,8 @@ func TestGetPetById(t *testing.T) {
//t.Log(resp) //t.Log(resp)
} }
if apiResponse.Response.StatusCode != 200 { if *apiResponse.Response.StatusCode != 200 {
t.Log(apiResponse.Response) t.Log(*apiResponse.Response)
} }
} }
@ -67,8 +67,8 @@ func TestGetPetByIdWithInvalidID(t *testing.T) {
} else { } else {
t.Log(resp) t.Log(resp)
} }
if apiResponse.Response.StatusCode != 200 { if *apiResponse.Response.StatusCode != 200 {
t.Log(apiResponse.Response) t.Log(*apiResponse.Response)
} }
} }
@ -79,29 +79,29 @@ func TestUpdatePetWithForm(t *testing.T) {
if err != nil { if err != nil {
t.Errorf("Error while updating pet by id") t.Errorf("Error while updating pet by id")
t.Log(err) t.Log(err)
t.Log(apiResponse) t.Log(*apiResponse)
} }
if apiResponse.Response.StatusCode != 200 { if *apiResponse.Response.StatusCode != 200 {
t.Log(apiResponse.Response) t.Log(*apiResponse.Response)
} }
} }
func TestFindPetsByStatus(t *testing.T) { func TestFindPetsByStatus(t *testing.T) {
s := sw.NewPetApi() s := sw.NewPetApi()
resp, apiResponse, err := s.FindPetsByStatus([]string {"pending"}) resp, apiResponse, err := s.FindPetsByStatus([]string {"available"})
if err != nil { if err != nil {
t.Errorf("Error while getting pet by id") t.Errorf("Error while getting pet by id")
t.Log(err) t.Log(err)
t.Log(apiResponse) t.Log(*apiResponse)
} else { } else {
t.Log(apiResponse) t.Log(*apiResponse)
if len(*resp) == 0 { if len(*resp) == 0 {
t.Errorf("Error no pets returned") t.Errorf("Error no pets returned")
} }
if apiResponse.Response.StatusCode != 200 { if *apiResponse.Response.StatusCode != 200 {
t.Log(apiResponse.Response) t.Log(*apiResponse.Response)
} }
} }
} }
@ -115,7 +115,8 @@ func TestUploadFile(t *testing.T) {
t.Errorf("Error while uploading file") t.Errorf("Error while uploading file")
t.Log(err) t.Log(err)
} }
if apiResponse.Response.StatusCode != 200 {
if *apiResponse.Response.StatusCode != 200 {
t.Log(apiResponse.Response) t.Log(apiResponse.Response)
} }
} }
@ -128,7 +129,7 @@ func TestDeletePet(t *testing.T) {
t.Errorf("Error while deleting pet by id") t.Errorf("Error while deleting pet by id")
t.Log(err) t.Log(err)
} }
if apiResponse.Response.StatusCode != 200 { if *apiResponse.Response.StatusCode != 200 {
t.Log(apiResponse.Response) t.Log(apiResponse.Response)
} }
} }