add pet and product images

This commit is contained in:
2026-03-26 19:56:17 -06:00
committed by Harkamal
parent 4f02825b96
commit a3ad1dab8c
14 changed files with 823 additions and 19 deletions

View File

@@ -121,6 +121,10 @@
{
"key": "bulkInventoryId",
"value": ""
},
{
"key": "adoptedPetId",
"value": "4"
}
],
"item": [
@@ -731,6 +735,95 @@
}
]
},
{
"name": "Upload Pet Image",
"request": {
"method": "POST",
"url": "{{baseUrl}}/api/v1/pets/{{petId}}/image",
"header": [
{
"key": "Authorization",
"value": "Bearer {{staffToken}}",
"type": "text"
}
],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "image",
"type": "file",
"src": "{{avatarFile}}"
}
]
}
},
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('Status code is 200', function () {",
" pm.response.to.have.status(200);",
"});",
"var jsonData = pm.response.json();",
"pm.expect(jsonData.imageUrl).to.be.a('string');"
]
}
}
]
},
{
"name": "Get Pet Image Public",
"request": {
"method": "GET",
"url": "{{baseUrl}}/api/v1/pets/{{petId}}/image"
},
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('Status code is 200', function () {",
" pm.response.to.have.status(200);",
"});",
"pm.test('Pet image response is an image', function () {",
" pm.expect(pm.response.headers.get('Content-Type')).to.include('image/');",
"});"
]
}
}
]
},
{
"name": "Delete Pet Image",
"request": {
"method": "DELETE",
"url": "{{baseUrl}}/api/v1/pets/{{petId}}/image",
"header": [
{
"key": "Authorization",
"value": "Bearer {{staffToken}}",
"type": "text"
}
]
},
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('Status code is 200', function () {",
" pm.response.to.have.status(200);",
"});"
]
}
}
]
},
{
"name": "Delete Pet",
"request": {
@@ -838,6 +931,120 @@
}
}
]
},
{
"name": "Upload Adopted Pet Image",
"request": {
"method": "POST",
"url": "{{baseUrl}}/api/v1/pets/{{adoptedPetId}}/image",
"header": [
{
"key": "Authorization",
"value": "Bearer {{staffToken}}",
"type": "text"
}
],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "image",
"type": "file",
"src": "{{avatarFile}}"
}
]
}
},
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('Status code is 200', function () {",
" pm.response.to.have.status(200);",
"});"
]
}
}
]
},
{
"name": "Get Adopted Pet Image Public",
"request": {
"method": "GET",
"url": "{{baseUrl}}/api/v1/pets/{{adoptedPetId}}/image"
},
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('Status code is 403', function () {",
" pm.response.to.have.status(403);",
"});"
]
}
}
]
},
{
"name": "Get Adopted Pet Image As Staff",
"request": {
"method": "GET",
"url": "{{baseUrl}}/api/v1/pets/{{adoptedPetId}}/image",
"header": [
{
"key": "Authorization",
"value": "Bearer {{staffToken}}",
"type": "text"
}
]
},
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('Status code is 200', function () {",
" pm.response.to.have.status(200);",
"});",
"pm.test('Pet image response is an image', function () {",
" pm.expect(pm.response.headers.get('Content-Type')).to.include('image/');",
"});"
]
}
}
]
},
{
"name": "Delete Adopted Pet Image",
"request": {
"method": "DELETE",
"url": "{{baseUrl}}/api/v1/pets/{{adoptedPetId}}/image",
"header": [
{
"key": "Authorization",
"value": "Bearer {{staffToken}}",
"type": "text"
}
]
},
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('Status code is 200', function () {",
" pm.response.to.have.status(200);",
"});"
]
}
}
]
}
]
},
@@ -1084,6 +1291,95 @@
}
}
]
},
{
"name": "Upload Product Image",
"request": {
"method": "POST",
"url": "{{baseUrl}}/api/v1/products/{{productId}}/image",
"header": [
{
"key": "Authorization",
"value": "Bearer {{staffToken}}",
"type": "text"
}
],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "image",
"type": "file",
"src": "{{avatarFile}}"
}
]
}
},
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('Status code is 200', function () {",
" pm.response.to.have.status(200);",
"});",
"var jsonData = pm.response.json();",
"pm.expect(jsonData.imageUrl).to.be.a('string');"
]
}
}
]
},
{
"name": "Get Product Image",
"request": {
"method": "GET",
"url": "{{baseUrl}}/api/v1/products/{{productId}}/image"
},
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('Status code is 200', function () {",
" pm.response.to.have.status(200);",
"});",
"pm.test('Product image response is an image', function () {",
" pm.expect(pm.response.headers.get('Content-Type')).to.include('image/');",
"});"
]
}
}
]
},
{
"name": "Delete Product Image",
"request": {
"method": "DELETE",
"url": "{{baseUrl}}/api/v1/products/{{productId}}/image",
"header": [
{
"key": "Authorization",
"value": "Bearer {{adminToken}}",
"type": "text"
}
]
},
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('Status code is 200', function () {",
" pm.response.to.have.status(200);",
"});"
]
}
}
]
}
]
},
@@ -4537,4 +4833,4 @@
]
}
]
}
}