Better tests (check that response match the structure) (#52)
Trailing zeros were removed from time in responses because of json marshaling features
This commit is contained in:
@@ -56,8 +56,11 @@ func TestGetProductTree(t *testing.T) {
|
||||
resp, err := c.Categories().Tree(ctx, test.params)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
continue
|
||||
}
|
||||
|
||||
compareJsonResponse(t, test.response, &GetProductTreeResponse{})
|
||||
|
||||
if resp.StatusCode != test.statusCode {
|
||||
t.Errorf("got wrong status code: got: %d, expected: %d", resp.StatusCode, test.statusCode)
|
||||
}
|
||||
@@ -118,8 +121,11 @@ func TestGetCategoryAttributes(t *testing.T) {
|
||||
resp, err := c.Categories().Attributes(ctx, test.params)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
continue
|
||||
}
|
||||
|
||||
compareJsonResponse(t, test.response, &GetCategoryAttributesResponse{})
|
||||
|
||||
if resp.StatusCode != test.statusCode {
|
||||
t.Errorf("got wrong status code: got: %d, expected: %d", resp.StatusCode, test.statusCode)
|
||||
}
|
||||
@@ -178,8 +184,11 @@ func TestGetAttributeDictionary(t *testing.T) {
|
||||
resp, err := c.Categories().AttributesDictionary(ctx, test.params)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
continue
|
||||
}
|
||||
|
||||
compareJsonResponse(t, test.response, &GetAttributeDictionaryResponse{})
|
||||
|
||||
if resp.StatusCode != test.statusCode {
|
||||
t.Errorf("got wrong status code: got: %d, expected: %d", resp.StatusCode, test.statusCode)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user