extend tests, update readme

This commit is contained in:
diPhantxm
2023-03-15 02:00:16 +03:00
parent a082200b4f
commit 396f370174
11 changed files with 268 additions and 37 deletions

View File

@@ -14,6 +14,7 @@ func TestGetAnalyticsData(t *testing.T) {
params *GetAnalyticsDataParams
response string
}{
// Test ok
{
http.StatusOK,
map[string]string{"Client-Id": "my-client-id", "Api-Key": "my-api-key"},
@@ -41,6 +42,16 @@ func TestGetAnalyticsData(t *testing.T) {
"timestamp": "2021-11-25 15:19:21"
}`,
},
{
// Test No Client-Id or Api-Key
http.StatusUnauthorized,
map[string]string{},
&GetAnalyticsDataParams{},
`{
"code": 16,
"message": "Client-Id and Api-Key headers are required"
}`,
},
}
for _, test := range tests {
@@ -64,6 +75,7 @@ func TestGetStocksOnWarehouses(t *testing.T) {
params *GetStocksOnWarehousesParams
response string
}{
// Test Ok
{
http.StatusOK,
map[string]string{"Client-Id": "my-client-id", "Api-Key": "my-api-key"},
@@ -87,6 +99,16 @@ func TestGetStocksOnWarehouses(t *testing.T) {
]
}
}`,
},
// Test No Client-Id or Api-Key
{
http.StatusUnauthorized,
map[string]string{},
&GetStocksOnWarehousesParams{},
`{
"code": 16,
"message": "Client-Id and Api-Key headers are required"
}`,
},
}

View File

@@ -14,6 +14,7 @@ func TestGetFBOShipmentsList(t *testing.T) {
params *GetFBOShipmentsListParams
response string
}{
// Test Ok
{
http.StatusOK,
map[string]string{"Client-Id": "my-client-id", "Api-Key": "my-api-key"},
@@ -115,6 +116,16 @@ func TestGetFBOShipmentsList(t *testing.T) {
]
}`,
},
// Test No Client-Id or Api-Key
{
http.StatusUnauthorized,
map[string]string{},
&GetFBOShipmentsListParams{},
`{
"code": 16,
"message": "Client-Id and Api-Key headers are required"
}`,
},
}
for _, test := range tests {

View File

@@ -14,6 +14,7 @@ func TestListUnprocessedShipments(t *testing.T) {
params *ListUnprocessedShipmentsParams
response string
}{
// Test Ok
{
http.StatusOK,
map[string]string{"Client-Id": "my-client-id", "Api-Key": "my-api-key"},
@@ -149,6 +150,16 @@ func TestListUnprocessedShipments(t *testing.T) {
}
}`,
},
// Test No Client-Id or Api-Key
{
http.StatusUnauthorized,
map[string]string{},
&ListUnprocessedShipmentsParams{},
`{
"code": 16,
"message": "Client-Id and Api-Key headers are required"
}`,
},
}
for _, test := range tests {
@@ -172,6 +183,7 @@ func TestGetFBSShipmentsList(t *testing.T) {
params *GetFBSShipmentsListParams
response string
}{
// Test Ok
{
http.StatusOK,
map[string]string{"Client-Id": "my-client-id", "Api-Key": "my-api-key"},
@@ -247,6 +259,16 @@ func TestGetFBSShipmentsList(t *testing.T) {
}
}`,
},
// Test No Client-Id or Api-Key
{
http.StatusUnauthorized,
map[string]string{},
&GetFBSShipmentsListParams{},
`{
"code": 16,
"message": "Client-Id and Api-Key headers are required"
}`,
},
}
for _, test := range tests {
@@ -270,6 +292,7 @@ func TestPackOrder(t *testing.T) {
params *PackOrderParams
response string
}{
// Test Ok
{
http.StatusOK,
map[string]string{"Client-Id": "my-client-id", "Api-Key": "my-api-key"},
@@ -295,6 +318,16 @@ func TestPackOrder(t *testing.T) {
]
}`,
},
// Test No Client-Id or Api-Key
{
http.StatusUnauthorized,
map[string]string{},
&PackOrderParams{},
`{
"code": 16,
"message": "Client-Id and Api-Key headers are required"
}`,
},
}
for _, test := range tests {

View File

@@ -14,6 +14,7 @@ func TestGetStocksInfo(t *testing.T) {
params *GetStocksInfoParams
response string
}{
// Test Ok
{
http.StatusOK,
map[string]string{"Client-Id": "my-client-id", "Api-Key": "my-api-key"},
@@ -51,27 +52,14 @@ func TestGetStocksInfo(t *testing.T) {
}
}`,
},
// Test No Client-Id or Api-Key
{
http.StatusBadRequest,
map[string]string{"Client-Id": "my-client-id", "Api-Key": "my-api-key"},
&GetStocksInfoParams{
Limit: 100,
LastId: "",
Filter: GetStocksInfoFilter{
OfferId: "136834",
ProductId: 214887921,
Visibility: "ALL",
},
},
http.StatusUnauthorized,
map[string]string{},
&GetStocksInfoParams{},
`{
"code": 0,
"details": [
{
"typeUrl": "string",
"value": "string"
}
],
"message": "string"
"code": 16,
"message": "Client-Id and Api-Key headers are required"
}`,
},
}
@@ -97,6 +85,7 @@ func TestGetProductDetails(t *testing.T) {
params *GetProductDetailsParams
response string
}{
// Test Ok
{
http.StatusOK,
map[string]string{"Client-Id": "my-client-id", "Api-Key": "my-api-key"},
@@ -227,21 +216,14 @@ func TestGetProductDetails(t *testing.T) {
}
}`,
},
// Test No Client-Id or Api-Key
{
http.StatusBadRequest,
map[string]string{"Client-Id": "my-client-id", "Api-Key": "my-api-key"},
&GetProductDetailsParams{
ProductId: 137208233,
},
http.StatusUnauthorized,
map[string]string{},
&GetProductDetailsParams{},
`{
"code": 0,
"details": [
{
"typeUrl": "string",
"value": "string"
}
],
"message": "string"
"code": 16,
"message": "Client-Id and Api-Key headers are required"
}`,
},
}
@@ -267,6 +249,7 @@ func TestUpdateStocks(t *testing.T) {
params *UpdateStocksParams
response string
}{
// Test Ok
{
http.StatusOK,
map[string]string{"Client-Id": "my-client-id", "Api-Key": "my-api-key"},
@@ -290,6 +273,16 @@ func TestUpdateStocks(t *testing.T) {
]
}`,
},
// Test No Client-Id or Api-Key
{
http.StatusUnauthorized,
map[string]string{},
&UpdateStocksParams{},
`{
"code": 16,
"message": "Client-Id and Api-Key headers are required"
}`,
},
}
for _, test := range tests {
@@ -313,6 +306,7 @@ func TestStocksInSellersWarehouse(t *testing.T) {
params *StocksInSellersWarehouseParams
response string
}{
// Test Ok
{
http.StatusOK,
map[string]string{"Client-Id": "my-client-id", "Api-Key": "my-api-key"},
@@ -332,6 +326,16 @@ func TestStocksInSellersWarehouse(t *testing.T) {
]
}`,
},
// Test No Client-Id or Api-Key
{
http.StatusUnauthorized,
map[string]string{},
&StocksInSellersWarehouseParams{},
`{
"code": 16,
"message": "Client-Id and Api-Key headers are required"
}`,
},
}
for _, test := range tests {
@@ -355,6 +359,7 @@ func TestUpdatePrices(t *testing.T) {
params *UpdatePricesParams
response string
}{
// Test Ok
{
http.StatusOK,
map[string]string{"Client-Id": "my-client-id", "Api-Key": "my-api-key"},
@@ -381,6 +386,16 @@ func TestUpdatePrices(t *testing.T) {
]
}`,
},
// Test No Client-Id or Api-Key
{
http.StatusUnauthorized,
map[string]string{},
&UpdatePricesParams{},
`{
"code": 16,
"message": "Client-Id and Api-Key headers are required"
}`,
},
}
for _, test := range tests {
@@ -404,6 +419,7 @@ func TestUpdateQuantityStockProducts(t *testing.T) {
params *UpdateQuantityStockProductsParams
response string
}{
// Test Ok
{
http.StatusOK,
map[string]string{"Client-Id": "my-client-id", "Api-Key": "my-api-key"},
@@ -429,6 +445,16 @@ func TestUpdateQuantityStockProducts(t *testing.T) {
]
}`,
},
// Test No Client-Id or Api-Key
{
http.StatusUnauthorized,
map[string]string{},
&UpdateQuantityStockProductsParams{},
`{
"code": 16,
"message": "Client-Id and Api-Key headers are required"
}`,
},
}
for _, test := range tests {
@@ -452,6 +478,7 @@ func TestCreateOrUpdateProduct(t *testing.T) {
params *CreateOrUpdateProductParams
response string
}{
// Test Ok
{
http.StatusOK,
map[string]string{"Client-Id": "my-client-id", "Api-Key": "my-api-key"},
@@ -533,6 +560,16 @@ func TestCreateOrUpdateProduct(t *testing.T) {
}
}`,
},
// Test No Client-Id or Api-Key
{
http.StatusUnauthorized,
map[string]string{},
&CreateOrUpdateProductParams{},
`{
"code": 16,
"message": "Client-Id and Api-Key headers are required"
}`,
},
}
for _, test := range tests {
@@ -556,6 +593,7 @@ func TestGetListOfProducts(t *testing.T) {
params *GetListOfProductsParams
response string
}{
// Test Ok
{
http.StatusOK,
map[string]string{"Client-Id": "my-client-id", "Api-Key": "my-api-key"},
@@ -581,6 +619,16 @@ func TestGetListOfProducts(t *testing.T) {
}
}`,
},
// Test No Client-Id or Api-Key
{
http.StatusUnauthorized,
map[string]string{},
&GetListOfProductsParams{},
`{
"code": 16,
"message": "Client-Id and Api-Key headers are required"
}`,
},
}
for _, test := range tests {

View File

@@ -13,6 +13,7 @@ func TestGetAvailablePromotions(t *testing.T) {
headers map[string]string
response string
}{
// Test Ok
{
http.StatusOK,
map[string]string{"Client-Id": "my-client-id", "Api-Key": "my-api-key"},
@@ -39,6 +40,15 @@ func TestGetAvailablePromotions(t *testing.T) {
]
}`,
},
// Test No Client-Id or Api-Key
{
http.StatusUnauthorized,
map[string]string{},
`{
"code": 16,
"message": "Client-Id and Api-Key headers are required"
}`,
},
}
for _, test := range tests {

View File

@@ -13,6 +13,7 @@ func TestGetCurrentRatingInfo(t *testing.T) {
headers map[string]string
response string
}{
// Test Ok
{
http.StatusOK,
map[string]string{"Client-Id": "my-client-id", "Api-Key": "my-api-key"},
@@ -41,6 +42,15 @@ func TestGetCurrentRatingInfo(t *testing.T) {
"premium": true
}`,
},
// Test No Client-Id or Api-Key
{
http.StatusUnauthorized,
map[string]string{},
`{
"code": 16,
"message": "Client-Id and Api-Key headers are required"
}`,
},
}
for _, test := range tests {
@@ -64,6 +74,7 @@ func TestGetRatingInfoForPeriod(t *testing.T) {
params *GetSellerRatingInfoForPeriodParams
response string
}{
// Test Ok
{
http.StatusOK,
map[string]string{"Client-Id": "my-client-id", "Api-Key": "my-api-key"},
@@ -108,6 +119,16 @@ func TestGetRatingInfoForPeriod(t *testing.T) {
]
}`,
},
// Test No Client-Id or Api-Key
{
http.StatusUnauthorized,
map[string]string{},
&GetSellerRatingInfoForPeriodParams{},
`{
"code": 16,
"message": "Client-Id and Api-Key headers are required"
}`,
},
}
for _, test := range tests {

View File

@@ -13,6 +13,7 @@ func TestGetListOfWarehouses(t *testing.T) {
headers map[string]string
response string
}{
// Test Ok
{
http.StatusOK,
map[string]string{"Client-Id": "my-client-id", "Api-Key": "my-api-key"},
@@ -41,6 +42,15 @@ func TestGetListOfWarehouses(t *testing.T) {
]
}`,
},
// Test No Client-Id or Api-Key
{
http.StatusUnauthorized,
map[string]string{},
`{
"code": 16,
"message": "Client-Id and Api-Key headers are required"
}`,
},
}
for _, test := range tests {