3770 lines
137 KiB
JSON
3770 lines
137 KiB
JSON
{
|
|
"info": {
|
|
"_postman_id": "98b758ba-065b-4906-adee-7dfd3ad86e02",
|
|
"name": "Ad Astra API Tests",
|
|
"description": "Collection for testing the Ad Astra API\n\nhttps://api.adastra-cbd.com/",
|
|
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
|
|
"_exporter_id": "10001192",
|
|
"_collection_link": "https://gold-equinox-726527.postman.co/workspace/d0b2d764-f48c-4a82-8c35-ae50b5b1167c/collection/10001192-98b758ba-065b-4906-adee-7dfd3ad86e02?action=share&source=collection_link&creator=10001192"
|
|
},
|
|
"item": [
|
|
{
|
|
"name": "Auth",
|
|
"item": [
|
|
{
|
|
"name": "Register",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"if (!(environment.isIntegrationTest)) {",
|
|
" pm.test(\"Response code is 200 OK\", () => {",
|
|
" pm.expect(pm.response.code).to.eql(200);",
|
|
" });",
|
|
"",
|
|
" if(pm.response.code === 200){",
|
|
" var responseJSON = JSON.parse(pm.response.text());",
|
|
"",
|
|
" pm.test('Response contains \"user\" property', () => {",
|
|
" pm.expect(responseJSON).to.have.property('user');",
|
|
" });",
|
|
"",
|
|
" var user = responseJSON.user || {};",
|
|
"",
|
|
" pm.test('User has \"email\" property', () => {",
|
|
" pm.expect(user).to.have.property('email');",
|
|
" });",
|
|
" pm.test('User has \"username\" property', () => {",
|
|
" pm.expect(user).to.have.property('username');",
|
|
" });",
|
|
" pm.test('User has \"token\" property', () => {",
|
|
" pm.expect(user).to.have.property('token');",
|
|
" });",
|
|
" }",
|
|
"}",
|
|
""
|
|
],
|
|
"type": "text/javascript",
|
|
"packages": {}
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "X-Requested-With",
|
|
"value": "XMLHttpRequest"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\"user\":{\"email\":\"anne@honime.com\", \"password\":\"annehonimepwd\", \"username\":\"annehonime\"}}"
|
|
},
|
|
"url": {
|
|
"raw": "{{apiUrl}}/user",
|
|
"host": [
|
|
"{{apiUrl}}"
|
|
],
|
|
"path": [
|
|
"user"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Login",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Response code is 200 OK\", () => {",
|
|
" pm.expect(pm.response.code).to.eql(200);",
|
|
"});",
|
|
"",
|
|
"if(pm.response.code === 200){",
|
|
" var responseJSON = JSON.parse(pm.response.text());",
|
|
"",
|
|
" pm.test('Response contains \"user\" property', () => {",
|
|
" pm.expect(responseJSON).to.have.property('user');",
|
|
" });",
|
|
"",
|
|
" var user = responseJSON.user || {};",
|
|
"",
|
|
" pm.test('User has \"email\" property', () => {",
|
|
" pm.expect(user).to.have.property('email');",
|
|
" });",
|
|
" pm.test('User has \"username\" property', () => {",
|
|
" pm.expect(user).to.have.property('username');",
|
|
" });",
|
|
" pm.test('User has an access \"token\" property', () => {",
|
|
" pm.expect(user).to.have.property('token');",
|
|
" pm.expect(user.token).to.be.a('string');",
|
|
" })",
|
|
"}",
|
|
""
|
|
],
|
|
"type": "text/javascript",
|
|
"packages": {}
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "X-Requested-With",
|
|
"value": "XMLHttpRequest"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\"user\":{\"email\":\"anne@honime.com\", \"password\":\"annehonimepwd\"}}"
|
|
},
|
|
"url": {
|
|
"raw": "{{apiUrl}}/user/login",
|
|
"host": [
|
|
"{{apiUrl}}"
|
|
],
|
|
"path": [
|
|
"user",
|
|
"login"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Login and Remember Token",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Response code is 200 OK\", () => {",
|
|
" pm.expect(pm.response.code).to.eql(200);",
|
|
"});",
|
|
"",
|
|
"if(pm.response.code === 200){",
|
|
" var responseJSON = JSON.parse(pm.response.text());",
|
|
"",
|
|
" pm.test('Response contains \"user\" property', () => {",
|
|
" pm.expect(responseJSON).to.have.property('user');",
|
|
" });",
|
|
"",
|
|
" var user = responseJSON.user || {};",
|
|
"",
|
|
" pm.test('User has \"email\" property', () => {",
|
|
" pm.expect(user).to.have.property('email');",
|
|
" });",
|
|
" pm.test('User has \"username\" property', () => {",
|
|
" pm.expect(user).to.have.property('username');",
|
|
" });",
|
|
" pm.test('User has an access \"token\" property', () => {",
|
|
" try {",
|
|
" pm.expect(user).to.have.property('token');",
|
|
" pm.expect(user.token).to.be.a('string');",
|
|
" /*pm.environment.set('token', user.token);*/",
|
|
" pm.collectionVariables.set('token', user.token);",
|
|
" } catch {",
|
|
" /*pm.environment.unset('token');*/",
|
|
" pm.collectionVariables.unset('token');",
|
|
" }",
|
|
" });",
|
|
" pm.test('Environment variable \"token\" has been set', () => {",
|
|
" pm.expect(pm.environment.get('token')).to.eql(user.token);",
|
|
" });",
|
|
"}",
|
|
""
|
|
],
|
|
"type": "text/javascript",
|
|
"packages": {}
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "X-Requested-With",
|
|
"value": "XMLHttpRequest"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\"user\":{\"email\":\"rampeur@gmail.com\", \"password\":\"DKxp24PSnr\"}}"
|
|
},
|
|
"url": {
|
|
"raw": "{{apiUrl}}/user/login",
|
|
"host": [
|
|
"{{apiUrl}}"
|
|
],
|
|
"path": [
|
|
"user",
|
|
"login"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Current User",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Response code is 200 OK\", () => {",
|
|
" pm.expect(pm.response.code).to.eql(200);",
|
|
"});",
|
|
"",
|
|
"if(pm.response.code === 200){",
|
|
" var responseJSON = JSON.parse(pm.response.text());",
|
|
"",
|
|
" pm.test('Response contains \"user\" property', () => {",
|
|
" pm.expect(responseJSON).to.have.property('user');",
|
|
" });",
|
|
"",
|
|
" var user = responseJSON.user || {};",
|
|
"",
|
|
" pm.test('User has \"email\" property', () => {",
|
|
" pm.expect(user).to.have.property('email');",
|
|
" });",
|
|
" pm.test('User has \"username\" property', () => {",
|
|
" pm.expect(user).to.have.property('username');",
|
|
" });",
|
|
" pm.test('User has an access \"token\" property', () => {",
|
|
" pm.expect(user).to.have.property('token');",
|
|
" pm.expect(user.token).to.be.a('string');",
|
|
" });",
|
|
"}",
|
|
""
|
|
],
|
|
"type": "text/javascript",
|
|
"packages": {}
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "GET",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "X-Requested-With",
|
|
"value": "XMLHttpRequest"
|
|
},
|
|
{
|
|
"key": "Authorization",
|
|
"value": "Token {{token}}"
|
|
}
|
|
],
|
|
"url": {
|
|
"raw": "{{apiUrl}}/user",
|
|
"host": [
|
|
"{{apiUrl}}"
|
|
],
|
|
"path": [
|
|
"user"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Update User",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Response code is 200 OK\", () => {",
|
|
" pm.expect(pm.response.code).to.eql(200);",
|
|
"});",
|
|
"",
|
|
"if(pm.response.code === 200){",
|
|
" var responseJSON = JSON.parse(pm.response.text());",
|
|
"",
|
|
" pm.test('Response contains \"user\" property', () => {",
|
|
" pm.expect(responseJSON).to.have.property('user');",
|
|
" });",
|
|
"",
|
|
" var user = responseJSON.user || {};",
|
|
"",
|
|
" pm.test('User has \"email\" property', () => {",
|
|
" pm.expect(user).to.have.property('email');",
|
|
" });",
|
|
" pm.test('User has \"username\" property', () => {",
|
|
" pm.expect(user).to.have.property('username');",
|
|
" });",
|
|
" pm.test('User has an access \"token\" property', () => {",
|
|
" pm.expect(user).to.have.property('token');",
|
|
" pm.expect(user.token).to.be.a('string');",
|
|
" });",
|
|
"}",
|
|
""
|
|
],
|
|
"type": "text/javascript",
|
|
"packages": {}
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "PUT",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "X-Requested-With",
|
|
"value": "XMLHttpRequest"
|
|
},
|
|
{
|
|
"key": "Authorization",
|
|
"value": "Token {{token}}"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\"user\":{\"email\":\"rampeur@gmail.com\"}}"
|
|
},
|
|
"url": {
|
|
"raw": "{{apiUrl}}/user",
|
|
"host": [
|
|
"{{apiUrl}}"
|
|
],
|
|
"path": [
|
|
"user"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "Clans",
|
|
"item": [
|
|
{
|
|
"name": "All Clans",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Response code is 200 OK\", () => {",
|
|
" pm.expect(pm.response.code).to.eql(200);",
|
|
"});",
|
|
"",
|
|
"if(pm.response.code === 200){",
|
|
" var responseJSON = JSON.parse(pm.response.text());",
|
|
"",
|
|
" pm.test('Response contains \"data\" property', () => {",
|
|
" pm.expect(responseJSON).to.have.property('data');",
|
|
" });",
|
|
"",
|
|
" var data = responseJSON.data;",
|
|
"",
|
|
" pm.test('Response\\'s \"data\" property contains \"clans\" property', () => {",
|
|
" pm.expect(data).to.have.property('clans');",
|
|
" });",
|
|
" pm.test('data\\'s \"clans\" property is an array', () => {",
|
|
" pm.expect(data.clans).to.be.an(\"array\");",
|
|
" });",
|
|
" pm.test('Response\\'s \"data\" property contains \"clansCount\" property', () => {",
|
|
" pm.expect(data).to.have.property('clansCount');",
|
|
" });",
|
|
" pm.test('data\\'s \"clansCount\" property is an integer', () => {",
|
|
" pm.expect(data.clansCount).to.be.a(\"number\");",
|
|
" });",
|
|
"",
|
|
" if(data.clans.length){",
|
|
" var clan = data.clans[0];",
|
|
"",
|
|
" pm.test('Clan has \"id\" property', () => {",
|
|
" pm.expect(clan).to.have.property('id');",
|
|
" });",
|
|
" pm.test('Clan has \"country\" property', () => {",
|
|
" pm.expect(clan).to.have.property('country');",
|
|
" });",
|
|
" pm.test('Clan has \"description\" property', () => {",
|
|
" pm.expect(clan).to.have.property('description');",
|
|
" });",
|
|
" pm.test('Clan has \"disbanding\" property', () => {",
|
|
" pm.expect(clan).to.have.property('disbanding');",
|
|
" });",
|
|
" pm.test('Clan has \"frameId\" property', () => {",
|
|
" pm.expect(clan).to.have.property('frameId');",
|
|
" });",
|
|
" pm.test('Clan has \"icon\" property', () => {",
|
|
" pm.expect(clan).to.have.property('icon');",
|
|
" });",
|
|
" pm.test('Clan has \"level\" property', () => {",
|
|
" pm.expect(clan).to.have.property('level');",
|
|
" });",
|
|
" pm.test('Clan has \"members\" property', () => {",
|
|
" pm.expect(clan).to.have.property('members');",
|
|
" });",
|
|
" pm.test('Clan\\'s \"members\" property is an Array', () => {",
|
|
" pm.expect(clan.members).to.be.an(\"array\");",
|
|
" });",
|
|
" pm.test('Clan has \"membersCount\" property', () => {",
|
|
" pm.expect(clan).to.have.property('membersCount');",
|
|
" });",
|
|
" pm.test('Clan\\'s \"membersCount\" property is equal to \"members\" array length', () => {",
|
|
" pm.expect(clan.membersCount).to.eql(clan.members.length);",
|
|
" });",
|
|
" pm.test('Clan has \"minLevel\" property', () => {",
|
|
" pm.expect(clan).to.have.property('minLevel');",
|
|
" });",
|
|
" pm.test('Clan has \"ownerId\" property', () => {",
|
|
" pm.expect(clan).to.have.property('ownerId');",
|
|
" });",
|
|
" pm.test('Clan has \"serverId\" property', () => {",
|
|
" pm.expect(clan).to.have.property('serverId');",
|
|
" });",
|
|
" pm.test('Clan has \"title\" property', () => {",
|
|
" pm.expect(clan).to.have.property('title');",
|
|
" });",
|
|
" pm.test('Clan has \"topActivity\" property', () => {",
|
|
" pm.expect(clan).to.have.property('topActivity');",
|
|
" });",
|
|
" pm.test('Clan has \"topDungeon\" property', () => {",
|
|
" pm.expect(clan).to.have.property('topDungeon');",
|
|
" });",
|
|
" pm.test('Clan has an ISO 8601 timestamp \"createdAt\" property', () => {",
|
|
" pm.expect(clan).to.have.property('createdAt');",
|
|
" pm.expect(clan.createdAt).to.eql(new Date(clan.createdAt).toISOString());",
|
|
" });",
|
|
" pm.test('Clan has an ISO 8601 timestamp \"updatedAt\" property', () => {",
|
|
" pm.expect(clan).to.have.property('updatedAt');",
|
|
" pm.expect(clan.updatedAt).to.eql(new Date(clan.updatedAt).toISOString());",
|
|
" });",
|
|
" pm.test('Clan has \"author\" property', () => {",
|
|
" pm.expect(clan).to.have.property('author');",
|
|
" });",
|
|
" pm.test('Clan\\'s \"author\" property has not credential properties', () => {",
|
|
" pm.expect(clan.author).not.to.have.property('salt');",
|
|
" pm.expect(clan.author).not.to.have.property('hash');",
|
|
" });",
|
|
" } else {",
|
|
" pm.test('clansCount is 0 when \"clans\" property is empty', () => {",
|
|
" pm.expect(data.clansCount).to.eql(0);",
|
|
" });",
|
|
" }",
|
|
"}",
|
|
""
|
|
],
|
|
"type": "text/javascript",
|
|
"packages": {}
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "GET",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json",
|
|
"type": "text"
|
|
},
|
|
{
|
|
"key": "X-Requested-With",
|
|
"value": "XMLHttpRequest",
|
|
"type": "text"
|
|
},
|
|
{
|
|
"key": "Authorization",
|
|
"value": "Token {{token}}",
|
|
"type": "text"
|
|
}
|
|
],
|
|
"url": {
|
|
"raw": "{{apiUrl}}/clans",
|
|
"host": [
|
|
"{{apiUrl}}"
|
|
],
|
|
"path": [
|
|
"clans"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Create Clan",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Response code is 201 Created\", () => {",
|
|
" pm.expect(pm.response.code).to.eql(201);",
|
|
"});",
|
|
"",
|
|
"if(pm.response.code === 201){",
|
|
" var responseJSON = JSON.parse(pm.response.text());",
|
|
"",
|
|
" pm.test('Response contains \"message\" property', () => {",
|
|
" pm.expect(responseJSON).to.have.property('message');",
|
|
" });",
|
|
" pm.test('Response contains \"data\" property', () => {",
|
|
" pm.expect(responseJSON).to.have.property('data');",
|
|
" });",
|
|
"",
|
|
" var clan = responseJSON.data || {};",
|
|
"",
|
|
" pm.test('Clan has \"id\" property', () => {",
|
|
" try {",
|
|
" pm.expect(clan).to.have.property('id');",
|
|
" } catch (e) {",
|
|
" throw (e);",
|
|
" }",
|
|
" pm.collectionVariables.set('clanId', clan.id);",
|
|
" });",
|
|
" pm.test('Clan has \"country\" property', () => {",
|
|
" pm.expect(clan).to.have.property('country');",
|
|
" });",
|
|
" pm.test('Clan has \"description\" property', () => {",
|
|
" pm.expect(clan).to.have.property('description');",
|
|
" });",
|
|
" pm.test('Clan has \"disbanding\" property', () => {",
|
|
" pm.expect(clan).to.have.property('disbanding');",
|
|
" });",
|
|
" pm.test('Clan has \"frameId\" property', () => {",
|
|
" pm.expect(clan).to.have.property('frameId');",
|
|
" });",
|
|
" pm.test('Clan has \"icon\" property', () => {",
|
|
" pm.expect(clan).to.have.property('icon');",
|
|
" });",
|
|
" pm.test('Clan has \"level\" property', () => {",
|
|
" pm.expect(clan).to.have.property('level');",
|
|
" });",
|
|
" pm.test('Clan has \"members\" property', () => {",
|
|
" pm.expect(clan).to.have.property('members');",
|
|
" });",
|
|
" pm.test('Clan\\'s \"members\" property is an Array', () => {",
|
|
" pm.expect(clan.members).to.be.an(\"array\");",
|
|
" });",
|
|
" pm.test('Clan has \"membersCount\" property', () => {",
|
|
" pm.expect(clan).to.have.property('membersCount');",
|
|
" });",
|
|
" pm.test('Clan\\'s \"membersCount\" property is equal to \"members\" array length', () => {",
|
|
" pm.expect(clan.membersCount).to.eql(clan.members.length);",
|
|
" });",
|
|
" pm.test('Clan has \"minLevel\" property', () => {",
|
|
" pm.expect(clan).to.have.property('minLevel');",
|
|
" });",
|
|
" pm.test('Clan has \"ownerId\" property', () => {",
|
|
" pm.expect(clan).to.have.property('ownerId');",
|
|
" });",
|
|
" pm.test('Clan has \"serverId\" property', () => {",
|
|
" pm.expect(clan).to.have.property('serverId');",
|
|
" });",
|
|
" pm.test('Clan has \"title\" property', () => {",
|
|
" pm.expect(clan).to.have.property('title');",
|
|
" });",
|
|
" pm.test('Clan has \"topActivity\" property', () => {",
|
|
" pm.expect(clan).to.have.property('topActivity');",
|
|
" });",
|
|
" pm.test('Clan has \"topDungeon\" property', () => {",
|
|
" pm.expect(clan).to.have.property('topDungeon');",
|
|
" });",
|
|
" pm.test('Clan has an ISO 8601 timestamp \"createdAt\" property', () => {",
|
|
" pm.expect(clan).to.have.property('createdAt');",
|
|
" pm.expect(clan.createdAt).to.eql(new Date(clan.createdAt).toISOString());",
|
|
" });",
|
|
" pm.test('Clan has an ISO 8601 timestamp \"updatedAt\" property', () => {",
|
|
" pm.expect(clan).to.have.property('updatedAt');",
|
|
" pm.expect(clan.updatedAt).to.eql(new Date(clan.updatedAt).toISOString());",
|
|
" });",
|
|
" pm.test('Clan has \"author\" property', () => {",
|
|
" pm.expect(clan).to.have.property('author');",
|
|
" });",
|
|
"}",
|
|
""
|
|
],
|
|
"type": "text/javascript",
|
|
"packages": {}
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "X-Requested-With",
|
|
"value": "XMLHttpRequest"
|
|
},
|
|
{
|
|
"key": "Authorization",
|
|
"value": "Token {{token}}"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"id\": \"026000001\",\n \"ownerId\": \"027000001\",\n \"level\": \"1\",\n \"title\": \"API Tests Guild\",\n \"description\": \"\",\n \"icon\": {\n \"flagColor1\": 7,\n \"flagColor2\": 0,\n \"flagShape\": 8,\n \"iconColor\": 19,\n \"iconShape\": 7\n },\n \"country\": \"2\",\n \"minLevel\": \"130\",\n \"serverId\": \"427\",\n \"members\": [],\n \"membersCount\": 0,\n \"disbanding\": false,\n \"topActivity\": \"813996\",\n \"topDungeon\": \"79507\",\n \"roleNames\": [],\n \"frameId\": 3,\n \"author\": \"642c4459666702637dcb5066\"\n}"
|
|
},
|
|
"url": {
|
|
"raw": "{{apiUrl}}/clans",
|
|
"host": [
|
|
"{{apiUrl}}"
|
|
],
|
|
"path": [
|
|
"clans"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Single Clan by id",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Response code is 200 OK\", () => {",
|
|
" pm.expect(pm.response.code).to.eql(200);",
|
|
"});",
|
|
"",
|
|
"if(pm.response.code === 200){",
|
|
" var responseJSON = JSON.parse(pm.response.text());",
|
|
"",
|
|
" pm.test('Response contains \"clan\" property', () => {",
|
|
" pm.expect(responseJSON).to.have.property('clan');",
|
|
" });",
|
|
"",
|
|
" var clan = responseJSON.clan || {};",
|
|
"",
|
|
" pm.test('Clan has \"id\" property', () => {",
|
|
" pm.expect(clan).to.have.property('id');",
|
|
" });",
|
|
" pm.test('Clan has \"country\" property', () => {",
|
|
" pm.expect(clan).to.have.property('country');",
|
|
" });",
|
|
" pm.test('Clan has \"description\" property', () => {",
|
|
" pm.expect(clan).to.have.property('description');",
|
|
" });",
|
|
" pm.test('Clan has \"disbanding\" property', () => {",
|
|
" pm.expect(clan).to.have.property('disbanding');",
|
|
" });",
|
|
" pm.test('Clan has \"frameId\" property', () => {",
|
|
" pm.expect(clan).to.have.property('frameId');",
|
|
" });",
|
|
" pm.test('Clan has \"icon\" property', () => {",
|
|
" pm.expect(clan).to.have.property('icon');",
|
|
" });",
|
|
" pm.test('Clan has \"level\" property', () => {",
|
|
" pm.expect(clan).to.have.property('level');",
|
|
" });",
|
|
" pm.test('Clan has \"members\" property', () => {",
|
|
" pm.expect(clan).to.have.property('members');",
|
|
" });",
|
|
" pm.test('Clan\\'s \"members\" property is an Array', () => {",
|
|
" pm.expect(clan.members).to.be.an(\"array\");",
|
|
" });",
|
|
" pm.test('Clan has \"membersCount\" property', () => {",
|
|
" pm.expect(clan).to.have.property('membersCount');",
|
|
" });",
|
|
" pm.test('Clan\\'s \"membersCount\" property is equal to \"members\" array length', () => {",
|
|
" pm.expect(clan.membersCount).to.eql(clan.members.length);",
|
|
" });",
|
|
" pm.test('Clan has \"minLevel\" property', () => {",
|
|
" pm.expect(clan).to.have.property('minLevel');",
|
|
" });",
|
|
" pm.test('Clan has \"ownerId\" property', () => {",
|
|
" pm.expect(clan).to.have.property('ownerId');",
|
|
" });",
|
|
" pm.test('Clan has \"serverId\" property', () => {",
|
|
" pm.expect(clan).to.have.property('serverId');",
|
|
" });",
|
|
" pm.test('Clan has \"title\" property', () => {",
|
|
" pm.expect(clan).to.have.property('title');",
|
|
" });",
|
|
" pm.test('Clan has \"topActivity\" property', () => {",
|
|
" pm.expect(clan).to.have.property('topActivity');",
|
|
" });",
|
|
" pm.test('Clan has \"topDungeon\" property', () => {",
|
|
" pm.expect(clan).to.have.property('topDungeon');",
|
|
" });",
|
|
" pm.test('Clan has an ISO 8601 timestamp \"createdAt\" property', () => {",
|
|
" pm.expect(clan).to.have.property('createdAt');",
|
|
" pm.expect(clan.createdAt).to.eql(new Date(clan.createdAt).toISOString());",
|
|
" });",
|
|
" pm.test('Clan has an ISO 8601 timestamp \"updatedAt\" property', () => {",
|
|
" pm.expect(clan).to.have.property('updatedAt');",
|
|
" pm.expect(clan.updatedAt).to.eql(new Date(clan.updatedAt).toISOString());",
|
|
" });",
|
|
" pm.test('Clan has \"author\" property', () => {",
|
|
" pm.expect(clan).to.have.property('author');",
|
|
" });",
|
|
" pm.test('Clan\\'s \"author\" property has not credential properties', () => {",
|
|
" pm.expect(clan.author).not.to.have.property('salt');",
|
|
" pm.expect(clan.author).not.to.have.property('hash');",
|
|
" });",
|
|
"}",
|
|
""
|
|
],
|
|
"type": "text/javascript",
|
|
"packages": {}
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "GET",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "X-Requested-With",
|
|
"value": "XMLHttpRequest"
|
|
},
|
|
{
|
|
"key": "Authorization",
|
|
"value": "Token {{token}}"
|
|
}
|
|
],
|
|
"url": {
|
|
"raw": "{{apiUrl}}/clans/{{clanId}}",
|
|
"host": [
|
|
"{{apiUrl}}"
|
|
],
|
|
"path": [
|
|
"clans",
|
|
"{{clanId}}"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Update Clan",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"if (!(pm.environment.get('isIntegrationTest'))) {",
|
|
" pm.test(\"Response code is 200 OK\", () => {",
|
|
" pm.expect(pm.response.code).to.eql(200);",
|
|
" });",
|
|
"",
|
|
" if(pm.response.code === 200){",
|
|
" var responseJSON = JSON.parse(pm.response.text());",
|
|
"",
|
|
" pm.test('Response contains \"message\" property', () => {",
|
|
" pm.expect(responseJSON).to.have.property('message');",
|
|
" });",
|
|
" pm.test('Response contains \"clan\" property', () => {",
|
|
" pm.expect(responseJSON).to.have.property('clan');",
|
|
" });",
|
|
"",
|
|
" var clan = responseJSON.clan || {};",
|
|
"",
|
|
" pm.test('Clan has \"id\" property', () => {",
|
|
" pm.expect(clan).to.have.property('id');",
|
|
" });",
|
|
" pm.test('Clan has \"country\" property', () => {",
|
|
" pm.expect(clan).to.have.property('country');",
|
|
" });",
|
|
" pm.test('Clan has \"description\" property equal to \"Ad Astra API Tests Guild\"', () => {",
|
|
" pm.expect(clan).to.have.property('description');",
|
|
" pm.expect(clan.description).to.eql(\"Ad Astra API Tests Guild\");",
|
|
" });",
|
|
" pm.test('Clan has \"disbanding\" property', () => {",
|
|
" pm.expect(clan).to.have.property('disbanding');",
|
|
" });",
|
|
" pm.test('Clan has \"frameId\" property', () => {",
|
|
" pm.expect(clan).to.have.property('frameId');",
|
|
" });",
|
|
" pm.test('Clan has \"icon\" property', () => {",
|
|
" pm.expect(clan).to.have.property('icon');",
|
|
" });",
|
|
" pm.test('Clan has \"level\" property', () => {",
|
|
" pm.expect(clan).to.have.property('level');",
|
|
" });",
|
|
" pm.test('Clan has \"members\" property', () => {",
|
|
" pm.expect(clan).to.have.property('members');",
|
|
" });",
|
|
" pm.test('Clan\\'s \"members\" property is an Array', () => {",
|
|
" pm.expect(clan.members).to.be.an(\"array\");",
|
|
" });",
|
|
" pm.test('Clan has \"membersCount\" property', () => {",
|
|
" pm.expect(clan).to.have.property('membersCount');",
|
|
" });",
|
|
" pm.test('Clan\\'s \"membersCount\" property is equal to \"members\" array length', () => {",
|
|
" pm.expect(clan.membersCount).to.eql(clan.members.length);",
|
|
" });",
|
|
" pm.test('Clan has \"minLevel\" property', () => {",
|
|
" pm.expect(clan).to.have.property('minLevel');",
|
|
" });",
|
|
" pm.test('Clan has \"ownerId\" property', () => {",
|
|
" pm.expect(clan).to.have.property('ownerId');",
|
|
" });",
|
|
" pm.test('Clan has \"serverId\" property', () => {",
|
|
" pm.expect(clan).to.have.property('serverId');",
|
|
" });",
|
|
" pm.test('Clan has \"title\" property equal to \"Ad Astra\"', () => {",
|
|
" pm.expect(clan).to.have.property('title');",
|
|
" pm.expect(clan.title).to.eql(\"Ad Astra\");",
|
|
" });",
|
|
" pm.test('Clan has \"topActivity\" property', () => {",
|
|
" pm.expect(clan).to.have.property('topActivity');",
|
|
" });",
|
|
" pm.test('Clan has \"topDungeon\" property', () => {",
|
|
" pm.expect(clan).to.have.property('topDungeon');",
|
|
" });",
|
|
" pm.test('Clan has an ISO 8601 timestamp \"createdAt\" property', () => {",
|
|
" pm.expect(clan).to.have.property('createdAt');",
|
|
" pm.expect(clan.createdAt).to.eql(new Date(clan.createdAt).toISOString());",
|
|
" });",
|
|
" pm.test('Clan has an ISO 8601 timestamp \"updatedAt\" property', () => {",
|
|
" pm.expect(clan).to.have.property('updatedAt');",
|
|
" pm.expect(clan.updatedAt).to.eql(new Date(clan.updatedAt).toISOString());",
|
|
" });",
|
|
" pm.test('Clan has \"author\" property', () => {",
|
|
" pm.expect(clan).to.have.property('author');",
|
|
" });",
|
|
" pm.test('Clan\\'s \"author\" property has not credential properties', () => {",
|
|
" pm.expect(clan.author).not.to.have.property('salt');",
|
|
" pm.expect(clan.author).not.to.have.property('hash');",
|
|
" });",
|
|
" }",
|
|
"}",
|
|
""
|
|
],
|
|
"type": "text/javascript",
|
|
"packages": {}
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "PUT",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "X-Requested-With",
|
|
"value": "XMLHttpRequest"
|
|
},
|
|
{
|
|
"key": "Authorization",
|
|
"value": "Token {{token}}"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"clan\": {\n \"title\":\"Ad Astra\",\n \"description\":\"Ad Astra API Tests Guild\",\n \"membersCount\": 0\n }\n}"
|
|
},
|
|
"url": {
|
|
"raw": "{{apiUrl}}/clans/{{clanId}}",
|
|
"host": [
|
|
"{{apiUrl}}"
|
|
],
|
|
"path": [
|
|
"clans",
|
|
"{{clanId}}"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Delete Clan",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Response code is 200 OK\", () => {",
|
|
" pm.expect(pm.response.code).to.eql(200);",
|
|
"});",
|
|
"",
|
|
"if(pm.response.code === 200){",
|
|
" var responseJSON = JSON.parse(pm.response.text());",
|
|
"",
|
|
" pm.test('Response contains \"message\" property', () => {",
|
|
" pm.expect(responseJSON).to.have.property('message');",
|
|
" });",
|
|
" pm.test('Response contains \"data\" property', () => {",
|
|
" pm.expect(responseJSON).to.have.property('data');",
|
|
" });",
|
|
"}"
|
|
],
|
|
"type": "text/javascript",
|
|
"packages": {}
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "DELETE",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "X-Requested-With",
|
|
"value": "XMLHttpRequest"
|
|
},
|
|
{
|
|
"key": "Authorization",
|
|
"value": "Token {{token}}"
|
|
}
|
|
],
|
|
"url": {
|
|
"raw": "{{apiUrl}}/clans/{{clanId}}",
|
|
"host": [
|
|
"{{apiUrl}}"
|
|
],
|
|
"path": [
|
|
"clans",
|
|
"{{clanId}}"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "Members",
|
|
"item": [
|
|
{
|
|
"name": "All Members",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Response code is 200 OK\", () => {",
|
|
" pm.expect(pm.response.code).to.eql(200);",
|
|
"});",
|
|
"",
|
|
"if(pm.response.code === 200){",
|
|
" var responseJSON = JSON.parse(pm.response.text());",
|
|
"",
|
|
" pm.test('Response contains \"data\" property', () => {",
|
|
" pm.expect(responseJSON).to.have.property('data');",
|
|
" });",
|
|
"",
|
|
" var data = responseJSON.data;",
|
|
"",
|
|
" pm.test('Response\\'s \"data\" property contains \"members\" property', () => {",
|
|
" pm.expect(data).to.have.property('members');",
|
|
" });",
|
|
" pm.test('data\\'s \"members\" property is an array', () => {",
|
|
" pm.expect(data.members).to.be.an(\"array\");",
|
|
" });",
|
|
" pm.test('Response\\'s \"data\" property contains \"membersCount\" property', () => {",
|
|
" pm.expect(data).to.have.property('membersCount');",
|
|
" });",
|
|
" pm.test('data\\'s \"membersCount\" property is an integer', () => {",
|
|
" pm.expect(data.membersCount).to.be.a(\"number\");",
|
|
" });",
|
|
"",
|
|
" if(data.members.length){",
|
|
" var member = data.members[0];",
|
|
"",
|
|
" pm.test('Member has \"id\" property', () => {",
|
|
" pm.expect(member).to.have.property('id');",
|
|
" });",
|
|
" pm.test('Member has \"allowPm\" property', () => {",
|
|
" pm.expect(member).to.have.property('allowPm');",
|
|
" });",
|
|
" pm.test('Member has \"avatarId\" property', () => {",
|
|
" pm.expect(member).to.have.property('avatarId');",
|
|
" });",
|
|
" pm.test('Member has \"clanIcon\" property', () => {",
|
|
" pm.expect(member).to.have.property('clanIcon');",
|
|
" });",
|
|
" pm.test('Member has \"clanId\" property', () => {",
|
|
" pm.expect(member).to.have.property('clanId');",
|
|
" });",
|
|
" pm.test('Member has \"clanRole\" property', () => {",
|
|
" pm.expect(member).to.have.property('clanRole');",
|
|
" });",
|
|
" pm.test('Member has \"clanTitle\" property', () => {",
|
|
" pm.expect(member).to.have.property('clanTitle');",
|
|
" });",
|
|
" pm.test('Member has \"commander\" property', () => {",
|
|
" pm.expect(member).to.have.property('commander');",
|
|
" });",
|
|
" pm.test('Member has \"frameId\" property', () => {",
|
|
" pm.expect(member).to.have.property('frameId');",
|
|
" });",
|
|
" pm.test('Member\\'s \"frameId\" property is an integer', () => {",
|
|
" pm.expect(member.frameId).to.be.a(\"number\");",
|
|
" });",
|
|
" pm.test('Member has \"isChatModerator\" property', () => {",
|
|
" pm.expect(member).to.have.property('isChatModerator');",
|
|
" });",
|
|
" pm.test('Member has \"lastLoginTime\" property', () => {",
|
|
" pm.expect(member).to.have.property('lastLoginTime');",
|
|
" });",
|
|
" pm.test('Member has \"leagueId\" property', () => {",
|
|
" pm.expect(member).to.have.property('leagueId');",
|
|
" });",
|
|
" pm.test('Member\\'s \"leagueId\" property is an integer', () => {",
|
|
" pm.expect(member.leagueId).to.be.a(\"number\");",
|
|
" });",
|
|
" pm.test('Member has \"name\" property', () => {",
|
|
" pm.expect(member).to.have.property('name');",
|
|
" });",
|
|
" pm.test('Member has \"level\" property', () => {",
|
|
" pm.expect(member).to.have.property('level');",
|
|
" });",
|
|
" pm.test('Member has \"serverId\" property', () => {",
|
|
" pm.expect(member).to.have.property('serverId');",
|
|
" });",
|
|
" pm.test('Member has an ISO 8601 timestamp \"createdAt\" property', () => {",
|
|
" pm.expect(member).to.have.property('createdAt');",
|
|
" pm.expect(member.createdAt).to.eql(new Date(member.createdAt).toISOString());",
|
|
" });",
|
|
" pm.test('Member has an ISO 8601 timestamp \"updatedAt\" property', () => {",
|
|
" pm.expect(member).to.have.property('updatedAt');",
|
|
" pm.expect(member.updatedAt).to.eql(new Date(member.updatedAt).toISOString());",
|
|
" });",
|
|
" pm.test('Member has \"author\" property', () => {",
|
|
" pm.expect(member).to.have.property('author');",
|
|
" });",
|
|
" pm.test('Member\\'s \"author\" property has not credential properties', () => {",
|
|
" pm.expect(member.author).not.to.have.property('salt');",
|
|
" pm.expect(member.author).not.to.have.property('hash');",
|
|
" });",
|
|
" } else {",
|
|
" pm.test('\"membersCount\" property is 0 when \"members\" property is empty', () => {",
|
|
" pm.expect(data.membersCount).to.eql(0);",
|
|
" });",
|
|
" }",
|
|
"}",
|
|
""
|
|
],
|
|
"type": "text/javascript",
|
|
"packages": {}
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "GET",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json",
|
|
"type": "text"
|
|
},
|
|
{
|
|
"key": "X-Requested-With",
|
|
"value": "XMLHttpRequest",
|
|
"type": "text"
|
|
},
|
|
{
|
|
"key": "Authorization",
|
|
"value": "Token {{token}}",
|
|
"type": "text"
|
|
}
|
|
],
|
|
"url": {
|
|
"raw": "{{apiUrl}}/members",
|
|
"host": [
|
|
"{{apiUrl}}"
|
|
],
|
|
"path": [
|
|
"members"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Create Member",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Response code is 201 Created\", () => {",
|
|
" pm.expect(pm.response.code).to.eql(201);",
|
|
"});",
|
|
"",
|
|
"if(pm.response.code === 201){",
|
|
" var responseJSON = JSON.parse(pm.response.text());",
|
|
"",
|
|
" pm.test('Response contains \"message\" property', () => {",
|
|
" pm.expect(responseJSON).to.have.property('message');",
|
|
" });",
|
|
" pm.test('Response contains \"data\" property', () => {",
|
|
" pm.expect(responseJSON).to.have.property('data');",
|
|
" });",
|
|
"",
|
|
" var member = responseJSON.data || {};",
|
|
"",
|
|
" pm.test('Member has \"id\" property', () => {",
|
|
" try {",
|
|
" pm.expect(member).to.have.property('id');",
|
|
" } catch (e) {",
|
|
" throw (e);",
|
|
" }",
|
|
" pm.collectionVariables.set('memberId', member.id);",
|
|
" });",
|
|
" pm.test('Member has \"allowPm\" property', () => {",
|
|
" pm.expect(member).to.have.property('allowPm');",
|
|
" });",
|
|
" pm.test('Member has \"avatarId\" property', () => {",
|
|
" pm.expect(member).to.have.property('avatarId');",
|
|
" });",
|
|
" pm.test('Member has \"clanIcon\" property', () => {",
|
|
" pm.expect(member).to.have.property('clanIcon');",
|
|
" });",
|
|
" pm.test('Member has \"clanId\" property', () => {",
|
|
" pm.expect(member).to.have.property('clanId');",
|
|
" });",
|
|
" pm.test('Member has \"clanRole\" property', () => {",
|
|
" pm.expect(member).to.have.property('clanRole');",
|
|
" });",
|
|
" pm.test('Member has \"clanTitle\" property', () => {",
|
|
" pm.expect(member).to.have.property('clanTitle');",
|
|
" });",
|
|
" pm.test('Member has \"commander\" property', () => {",
|
|
" pm.expect(member).to.have.property('commander');",
|
|
" });",
|
|
" pm.test('Member has \"frameId\" property', () => {",
|
|
" pm.expect(member).to.have.property('frameId');",
|
|
" });",
|
|
" pm.test('Member\\'s \"frameId\" property is an integer', () => {",
|
|
" pm.expect(member.frameId).to.be.a(\"number\");",
|
|
" });",
|
|
" pm.test('Member has \"isChatModerator\" property', () => {",
|
|
" pm.expect(member).to.have.property('isChatModerator');",
|
|
" });",
|
|
" pm.test('Member has \"lastLoginTime\" property', () => {",
|
|
" pm.expect(member).to.have.property('lastLoginTime');",
|
|
" });",
|
|
" pm.test('Member has \"leagueId\" property', () => {",
|
|
" pm.expect(member).to.have.property('leagueId');",
|
|
" });",
|
|
" pm.test('Member\\'s \"leagueId\" property is an integer', () => {",
|
|
" pm.expect(member.leagueId).to.be.a(\"number\");",
|
|
" });",
|
|
" pm.test('Member has \"name\" property', () => {",
|
|
" pm.expect(member).to.have.property('name');",
|
|
" });",
|
|
" pm.test('Member has \"level\" property', () => {",
|
|
" pm.expect(member).to.have.property('level');",
|
|
" });",
|
|
" pm.test('Member has \"serverId\" property', () => {",
|
|
" pm.expect(member).to.have.property('serverId');",
|
|
" });",
|
|
" pm.test('Member has an ISO 8601 timestamp \"createdAt\" property', () => {",
|
|
" pm.expect(member).to.have.property('createdAt');",
|
|
" pm.expect(member.createdAt).to.eql(new Date(member.createdAt).toISOString());",
|
|
" });",
|
|
" pm.test('Member has an ISO 8601 timestamp \"updatedAt\" property', () => {",
|
|
" pm.expect(member).to.have.property('updatedAt');",
|
|
" pm.expect(member.updatedAt).to.eql(new Date(member.updatedAt).toISOString());",
|
|
" });",
|
|
" pm.test('Member has \"author\" property', () => {",
|
|
" pm.expect(member).to.have.property('author');",
|
|
" });",
|
|
" pm.test('Member\\'s \"author\" property has not credential properties', () => {",
|
|
" pm.expect(member.author).not.to.have.property('salt');",
|
|
" pm.expect(member.author).not.to.have.property('hash');",
|
|
" });",
|
|
"}",
|
|
""
|
|
],
|
|
"type": "text/javascript",
|
|
"packages": {}
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "X-Requested-With",
|
|
"value": "XMLHttpRequest"
|
|
},
|
|
{
|
|
"key": "Authorization",
|
|
"value": "Token {{token}}"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"id\": \"027000001\",\n \"name\": \"API Tests Member\",\n \"lastLoginTime\": \"1763913494\",\n \"serverId\": \"427\",\n \"level\": \"130\",\n \"clanId\": \"026000001\",\n \"clanRole\": \"255\",\n \"commander\": false,\n \"avatarId\": \"891\",\n \"isChatModerator\": false,\n \"frameId\": 215,\n \"leagueId\": 3,\n \"allowPm\": \"all\",\n \"clanTitle\": \"Element115\",\n \"clanIcon\": {\n \"flagColor1\": 7,\n \"flagColor2\": 0,\n \"flagShape\": 8,\n \"iconColor\": 19,\n \"iconShape\": 7\n },\n \"author\": \"642c4459666702637dcb5066\"\n}"
|
|
},
|
|
"url": {
|
|
"raw": "{{apiUrl}}/members",
|
|
"host": [
|
|
"{{apiUrl}}"
|
|
],
|
|
"path": [
|
|
"members"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Single Member by id",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Response code is 200 OK\", () => {",
|
|
" pm.expect(pm.response.code).to.eql(200);",
|
|
"});",
|
|
"",
|
|
"if(pm.response.code === 200){",
|
|
" var responseJSON = JSON.parse(pm.response.text());",
|
|
"",
|
|
" pm.test('Response contains \"member\" property', () => {",
|
|
" pm.expect(responseJSON).to.have.property('member');",
|
|
" });",
|
|
"",
|
|
" var member = responseJSON.member || {};",
|
|
"",
|
|
" pm.test('Member has \"id\" property', () => {",
|
|
" pm.expect(member).to.have.property('id');",
|
|
" });",
|
|
" pm.test('Member has \"allowPm\" property', () => {",
|
|
" pm.expect(member).to.have.property('allowPm');",
|
|
" });",
|
|
" pm.test('Member has \"avatarId\" property', () => {",
|
|
" pm.expect(member).to.have.property('avatarId');",
|
|
" });",
|
|
" pm.test('Member has \"clanIcon\" property', () => {",
|
|
" pm.expect(member).to.have.property('clanIcon');",
|
|
" });",
|
|
" pm.test('Member has \"clanId\" property', () => {",
|
|
" pm.expect(member).to.have.property('clanId');",
|
|
" });",
|
|
" pm.test('Member has \"clanRole\" property', () => {",
|
|
" pm.expect(member).to.have.property('clanRole');",
|
|
" });",
|
|
" pm.test('Member has \"clanTitle\" property', () => {",
|
|
" pm.expect(member).to.have.property('clanTitle');",
|
|
" });",
|
|
" pm.test('Member has \"commander\" property', () => {",
|
|
" pm.expect(member).to.have.property('commander');",
|
|
" });",
|
|
" pm.test('Member has \"frameId\" property', () => {",
|
|
" pm.expect(member).to.have.property('frameId');",
|
|
" });",
|
|
" pm.test('Member\\'s \"frameId\" property is an integer', () => {",
|
|
" pm.expect(member.frameId).to.be.a(\"number\");",
|
|
" });",
|
|
" pm.test('Member has \"isChatModerator\" property', () => {",
|
|
" pm.expect(member).to.have.property('isChatModerator');",
|
|
" });",
|
|
" pm.test('Member has \"lastLoginTime\" property', () => {",
|
|
" pm.expect(member).to.have.property('lastLoginTime');",
|
|
" });",
|
|
" pm.test('Member has \"leagueId\" property', () => {",
|
|
" pm.expect(member).to.have.property('leagueId');",
|
|
" });",
|
|
" pm.test('Member\\'s \"leagueId\" property is an integer', () => {",
|
|
" pm.expect(member.leagueId).to.be.a(\"number\");",
|
|
" });",
|
|
" pm.test('Member has \"name\" property', () => {",
|
|
" pm.expect(member).to.have.property('name');",
|
|
" });",
|
|
" pm.test('Member has \"level\" property', () => {",
|
|
" pm.expect(member).to.have.property('level');",
|
|
" });",
|
|
" pm.test('Member has \"serverId\" property', () => {",
|
|
" pm.expect(member).to.have.property('serverId');",
|
|
" });",
|
|
" pm.test('Member has an ISO 8601 timestamp \"createdAt\" property', () => {",
|
|
" pm.expect(member).to.have.property('createdAt');",
|
|
" pm.expect(member.createdAt).to.eql(new Date(member.createdAt).toISOString());",
|
|
" });",
|
|
" pm.test('Member has an ISO 8601 timestamp \"updatedAt\" property', () => {",
|
|
" pm.expect(member).to.have.property('updatedAt');",
|
|
" pm.expect(member.updatedAt).to.eql(new Date(member.updatedAt).toISOString());",
|
|
" });",
|
|
" pm.test('Member has \"author\" property', () => {",
|
|
" pm.expect(member).to.have.property('author');",
|
|
" });",
|
|
" pm.test('Member\\'s \"author\" property has not credential properties', () => {",
|
|
" pm.expect(member.author).not.to.have.property('salt');",
|
|
" pm.expect(member.author).not.to.have.property('hash');",
|
|
" });",
|
|
"}",
|
|
""
|
|
],
|
|
"type": "text/javascript",
|
|
"packages": {}
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "GET",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "X-Requested-With",
|
|
"value": "XMLHttpRequest"
|
|
},
|
|
{
|
|
"key": "Authorization",
|
|
"value": "Token {{token}}"
|
|
}
|
|
],
|
|
"url": {
|
|
"raw": "{{apiUrl}}/members/{{memberId}}",
|
|
"host": [
|
|
"{{apiUrl}}"
|
|
],
|
|
"path": [
|
|
"members",
|
|
"{{memberId}}"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Update Member",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"if (!(pm.environment.get('isIntegrationTest'))) {",
|
|
" pm.test(\"Response code is 200 OK\", () => {",
|
|
" pm.expect(pm.response.code).to.eql(200);",
|
|
" });",
|
|
"",
|
|
" if(pm.response.code === 200){",
|
|
" var responseJSON = JSON.parse(pm.response.text());",
|
|
"",
|
|
" pm.test('Response contains \"message\" property', () => {",
|
|
" pm.expect(responseJSON).to.have.property('message');",
|
|
" });",
|
|
" pm.test('Response contains \"member\" property', () => {",
|
|
" pm.expect(responseJSON).to.have.property('member');",
|
|
" });",
|
|
"",
|
|
" var member = responseJSON.member || {};",
|
|
"",
|
|
" pm.test('Member has \"id\" property', () => {",
|
|
" pm.expect(member).to.have.property('id');",
|
|
" });",
|
|
" pm.test('Member has \"allowPm\" property', () => {",
|
|
" pm.expect(member).to.have.property('allowPm');",
|
|
" });",
|
|
" pm.test('Member has \"avatarId\" property', () => {",
|
|
" pm.expect(member).to.have.property('avatarId');",
|
|
" });",
|
|
" pm.test('Member has \"clanIcon\" property', () => {",
|
|
" pm.expect(member).to.have.property('clanIcon');",
|
|
" });",
|
|
" pm.test('Member has \"clanId\" property', () => {",
|
|
" pm.expect(member).to.have.property('clanId');",
|
|
" });",
|
|
" pm.test('Member has \"clanRole\" property', () => {",
|
|
" pm.expect(member).to.have.property('clanRole');",
|
|
" });",
|
|
" pm.test('Member has \"clanTitle\" property', () => {",
|
|
" pm.expect(member).to.have.property('clanTitle');",
|
|
" });",
|
|
" pm.test('Member has \"commander\" property equal to true', () => {",
|
|
" pm.expect(member).to.have.property('commander');",
|
|
" pm.expect(member.commander).to.eql(true);",
|
|
" });",
|
|
" pm.test('Member has \"frameId\" property', () => {",
|
|
" pm.expect(member).to.have.property('frameId');",
|
|
" });",
|
|
" pm.test('Member\\'s \"frameId\" property is an integer', () => {",
|
|
" pm.expect(member.frameId).to.be.a(\"number\");",
|
|
" });",
|
|
" pm.test('Member has \"isChatModerator\" property', () => {",
|
|
" pm.expect(member).to.have.property('isChatModerator');",
|
|
" });",
|
|
" pm.test('Member has \"lastLoginTime\" property', () => {",
|
|
" pm.expect(member).to.have.property('lastLoginTime');",
|
|
" });",
|
|
" pm.test('Member has \"leagueId\" property', () => {",
|
|
" pm.expect(member).to.have.property('leagueId');",
|
|
" });",
|
|
" pm.test('Member\\'s \"leagueId\" property is an integer', () => {",
|
|
" pm.expect(member.leagueId).to.be.a(\"number\");",
|
|
" });",
|
|
" pm.test('Member has \"name\" property equal to \"Per Aspera\"', () => {",
|
|
" pm.expect(member).to.have.property('name');",
|
|
" pm.expect(member.name).to.eql(\"Per Aspera\");",
|
|
" });",
|
|
" pm.test('Member has \"level\" property', () => {",
|
|
" pm.expect(member).to.have.property('level');",
|
|
" });",
|
|
" pm.test('Member has \"serverId\" property', () => {",
|
|
" pm.expect(member).to.have.property('serverId');",
|
|
" });",
|
|
" pm.test('Member has an ISO 8601 timestamp \"createdAt\" property', () => {",
|
|
" pm.expect(member).to.have.property('createdAt');",
|
|
" pm.expect(member.createdAt).to.eql(new Date(member.createdAt).toISOString());",
|
|
" });",
|
|
" pm.test('Member has an ISO 8601 timestamp \"updatedAt\" property', () => {",
|
|
" pm.expect(member).to.have.property('updatedAt');",
|
|
" pm.expect(member.updatedAt).to.eql(new Date(member.updatedAt).toISOString());",
|
|
" });",
|
|
" pm.test('Member has \"author\" property', () => {",
|
|
" pm.expect(member).to.have.property('author');",
|
|
" });",
|
|
" pm.test('Member\\'s \"author\" property has not credential properties', () => {",
|
|
" pm.expect(member.author).not.to.have.property('salt');",
|
|
" pm.expect(member.author).not.to.have.property('hash');",
|
|
" });",
|
|
" }",
|
|
"}",
|
|
""
|
|
],
|
|
"type": "text/javascript",
|
|
"packages": {}
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "PUT",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "X-Requested-With",
|
|
"value": "XMLHttpRequest"
|
|
},
|
|
{
|
|
"key": "Authorization",
|
|
"value": "Token {{token}}"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"member\": {\n \"name\":\"Per Aspera\",\n \"commander\": true\n }\n}"
|
|
},
|
|
"url": {
|
|
"raw": "{{apiUrl}}/members/{{memberId}}",
|
|
"host": [
|
|
"{{apiUrl}}"
|
|
],
|
|
"path": [
|
|
"members",
|
|
"{{memberId}}"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Delete Member",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Response code is 200 OK\", () => {",
|
|
" pm.expect(pm.response.code).to.eql(200);",
|
|
"});",
|
|
"",
|
|
"if(pm.response.code === 200){",
|
|
" var responseJSON = JSON.parse(pm.response.text());",
|
|
"",
|
|
" pm.test('Response contains \"message\" property', () => {",
|
|
" pm.expect(responseJSON).to.have.property('message');",
|
|
" });",
|
|
" pm.test('Response contains \"data\" property', () => {",
|
|
" pm.expect(responseJSON).to.have.property('data');",
|
|
" });",
|
|
"}"
|
|
],
|
|
"type": "text/javascript",
|
|
"packages": {}
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "DELETE",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "X-Requested-With",
|
|
"value": "XMLHttpRequest"
|
|
},
|
|
{
|
|
"key": "Authorization",
|
|
"value": "Token {{token}}"
|
|
}
|
|
],
|
|
"url": {
|
|
"raw": "{{apiUrl}}/members/{{memberId}}",
|
|
"host": [
|
|
"{{apiUrl}}"
|
|
],
|
|
"path": [
|
|
"members",
|
|
"{{memberId}}"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "Articles",
|
|
"item": [
|
|
{
|
|
"name": "All Articles",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Response code is 200 OK\", () => {",
|
|
" pm.expect(pm.response.code).to.eql(200);",
|
|
"});",
|
|
"",
|
|
"if(pm.response.code === 200){",
|
|
" var responseJSON = JSON.parse(pm.response.text());",
|
|
"",
|
|
" pm.test('Response contains \"data\" property', () => {",
|
|
" pm.expect(responseJSON).to.have.property('data');",
|
|
" });",
|
|
"",
|
|
" var data = responseJSON.data;",
|
|
"",
|
|
" pm.test('Response\\'s \"data\" property contains \"articles\" property', () => {",
|
|
" pm.expect(data).to.have.property('articles');",
|
|
" });",
|
|
" pm.test('data\\'s \"articles\" property is an array', () => {",
|
|
" pm.expect(data.articles).to.be.an(\"array\");",
|
|
" });",
|
|
" pm.test('Response\\'s \"data\" property contains \"articlesCount\" property', () => {",
|
|
" pm.expect(data).to.have.property('articlesCount');",
|
|
" });",
|
|
" pm.test('data\\'s \"articlesCount\" property is an integer', () => {",
|
|
" pm.expect(data.articlesCount).to.be.a(\"number\");",
|
|
" });",
|
|
"",
|
|
" if(data.articles.length){",
|
|
" var article = data.articles[0];",
|
|
"",
|
|
" pm.test('Article has \"title\" property', () => {",
|
|
" pm.expect(article).to.have.property('title');",
|
|
" });",
|
|
" pm.test('Article has \"slug\" property', () => {",
|
|
" pm.expect(article).to.have.property('slug');",
|
|
" });",
|
|
" pm.test('Article has \"body\" property', () => {",
|
|
" pm.expect(article).to.have.property('body');",
|
|
" });",
|
|
" pm.test('Article has \"description\" property', () => {",
|
|
" pm.expect(article).to.have.property('description');",
|
|
" });",
|
|
" pm.test('Article has \"tagList\" property', () => {",
|
|
" pm.expect(article).to.have.property('tagList');",
|
|
" });",
|
|
" pm.test('Article\\'s \"tagList\" property is an Array', () => {",
|
|
" pm.expect(article.tagList).to.be.an(\"array\");",
|
|
" });",
|
|
" pm.test('Article has \"favorited\" property', () => {",
|
|
" pm.expect(article).to.have.property('favorited');",
|
|
" });",
|
|
" pm.test('Article has \"favoritesCount\" property', () => {",
|
|
" pm.expect(article).to.have.property('favoritesCount');",
|
|
" });",
|
|
" pm.test('Article\\'s \"favoritesCount\" property is an integer', () => {",
|
|
" pm.expect(article.favoritesCount).to.be.a(\"number\");",
|
|
" });",
|
|
" pm.test('Article has an ISO 8601 timestamp \"createdAt\" property', () => {",
|
|
" pm.expect(article).to.have.property('createdAt');",
|
|
" pm.expect(article.createdAt).to.eql(new Date(article.createdAt).toISOString());",
|
|
" });",
|
|
" pm.test('Article has an ISO 8601 timestamp \"updatedAt\" property', () => {",
|
|
" pm.expect(article).to.have.property('updatedAt');",
|
|
" pm.expect(article.updatedAt).to.eql(new Date(article.updatedAt).toISOString());",
|
|
" });",
|
|
" pm.test('Article has \"author\" property', () => {",
|
|
" pm.expect(article).to.have.property('author');",
|
|
" });",
|
|
" pm.test('Article\\'s \"author\" property has not credential properties', () => {",
|
|
" pm.expect(article.author).not.to.have.property('salt');",
|
|
" pm.expect(article.author).not.to.have.property('hash');",
|
|
" });",
|
|
" } else {",
|
|
" pm.test('articlesCount is 0 when \"articles\" property is empty', () => {",
|
|
" pm.expect(data.articlesCount).to.eql(0);",
|
|
" });",
|
|
" }",
|
|
"}",
|
|
""
|
|
],
|
|
"type": "text/javascript",
|
|
"packages": {}
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "GET",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "X-Requested-With",
|
|
"value": "XMLHttpRequest"
|
|
}
|
|
],
|
|
"url": {
|
|
"raw": "{{apiUrl}}/articles",
|
|
"host": [
|
|
"{{apiUrl}}"
|
|
],
|
|
"path": [
|
|
"articles"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Articles by Author",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Response code is 200 OK\", () => {",
|
|
" pm.expect(pm.response.code).to.eql(200);",
|
|
"});",
|
|
"",
|
|
"if(pm.response.code === 200){",
|
|
" var responseJSON = JSON.parse(pm.response.text());",
|
|
"",
|
|
" pm.test('Response contains \"data\" property', () => {",
|
|
" pm.expect(responseJSON).to.have.property('data');",
|
|
" });",
|
|
"",
|
|
" var data = responseJSON.data;",
|
|
"",
|
|
" pm.test('Response\\'s \"data\" property contains \"articles\" property', () => {",
|
|
" pm.expect(data).to.have.property('articles');",
|
|
" });",
|
|
" pm.test('data\\'s \"articles\" property is an array', () => {",
|
|
" pm.expect(data.articles).to.be.an(\"array\");",
|
|
" });",
|
|
" pm.test('Response\\'s \"data\" property contains \"articlesCount\" property', () => {",
|
|
" pm.expect(data).to.have.property('articlesCount');",
|
|
" });",
|
|
" pm.test('data\\'s \"articlesCount\" property is an integer', () => {",
|
|
" pm.expect(data.articlesCount).to.be.a(\"number\");",
|
|
" });",
|
|
"",
|
|
" if(data.articles.length){",
|
|
" var article = data.articles[0];",
|
|
"",
|
|
" pm.test('Article has \"title\" property', () => {",
|
|
" pm.expect(article).to.have.property('title');",
|
|
" });",
|
|
" pm.test('Article has \"slug\" property', () => {",
|
|
" pm.expect(article).to.have.property('slug');",
|
|
" });",
|
|
" pm.test('Article has \"body\" property', () => {",
|
|
" pm.expect(article).to.have.property('body');",
|
|
" });",
|
|
" pm.test('Article has \"description\" property', () => {",
|
|
" pm.expect(article).to.have.property('description');",
|
|
" });",
|
|
" pm.test('Article has \"tagList\" property', () => {",
|
|
" pm.expect(article).to.have.property('tagList');",
|
|
" });",
|
|
" pm.test('Article\\'s \"tagList\" property is an Array', () => {",
|
|
" pm.expect(article.tagList).to.be.an(\"array\");",
|
|
" });",
|
|
" pm.test('Article has \"favorited\" property', () => {",
|
|
" pm.expect(article).to.have.property('favorited');",
|
|
" });",
|
|
" pm.test('Article has \"favoritesCount\" property', () => {",
|
|
" pm.expect(article).to.have.property('favoritesCount');",
|
|
" });",
|
|
" pm.test('Article\\'s \"favoritesCount\" property is an integer', () => {",
|
|
" pm.expect(article.favoritesCount).to.be.a(\"number\");",
|
|
" });",
|
|
" pm.test('Article has an ISO 8601 timestamp \"createdAt\" property', () => {",
|
|
" pm.expect(article).to.have.property('createdAt');",
|
|
" pm.expect(article.createdAt).to.eql(new Date(article.createdAt).toISOString());",
|
|
" });",
|
|
" pm.test('Article has an ISO 8601 timestamp \"updatedAt\" property', () => {",
|
|
" pm.expect(article).to.have.property('updatedAt');",
|
|
" pm.expect(article.updatedAt).to.eql(new Date(article.updatedAt).toISOString());",
|
|
" });",
|
|
" pm.test('Article has \"author\" property', () => {",
|
|
" pm.expect(article).to.have.property('author');",
|
|
" });",
|
|
" pm.test('Article\\'s \"author\" property has not credential properties', () => {",
|
|
" pm.expect(article.author).not.to.have.property('salt');",
|
|
" pm.expect(article.author).not.to.have.property('hash');",
|
|
" });",
|
|
" } else {",
|
|
" pm.test('articlesCount is 0 when \"articles\" property is empty', () => {",
|
|
" pm.expect(data.articlesCount).to.eql(0);",
|
|
" });",
|
|
" }",
|
|
"}",
|
|
""
|
|
],
|
|
"type": "text/javascript",
|
|
"packages": {}
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "GET",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "X-Requested-With",
|
|
"value": "XMLHttpRequest"
|
|
}
|
|
],
|
|
"url": {
|
|
"raw": "{{apiUrl}}/articles?author=solide",
|
|
"host": [
|
|
"{{apiUrl}}"
|
|
],
|
|
"path": [
|
|
"articles"
|
|
],
|
|
"query": [
|
|
{
|
|
"key": "author",
|
|
"value": "solide"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Articles Favorited by Username",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Response code is 200 OK\", () => {",
|
|
" pm.expect(pm.response.code).to.eql(200);",
|
|
"});",
|
|
"",
|
|
"if(pm.response.code === 200){",
|
|
" var responseJSON = JSON.parse(pm.response.text());",
|
|
"",
|
|
" pm.test('Response contains \"data\" property', () => {",
|
|
" pm.expect(responseJSON).to.have.property('data');",
|
|
" });",
|
|
"",
|
|
" var data = responseJSON.data;",
|
|
"",
|
|
" pm.test('Response\\'s \"data\" property contains \"articles\" property', () => {",
|
|
" pm.expect(data).to.have.property('articles');",
|
|
" });",
|
|
" pm.test('data\\'s \"articles\" property is an array', () => {",
|
|
" pm.expect(data.articles).to.be.an(\"array\");",
|
|
" });",
|
|
" pm.test('Response\\'s \"data\" property contains \"articlesCount\" property', () => {",
|
|
" pm.expect(data).to.have.property('articlesCount');",
|
|
" });",
|
|
" pm.test('data\\'s \"articlesCount\" property is an integer', () => {",
|
|
" pm.expect(data.articlesCount).to.be.a(\"number\");",
|
|
" });",
|
|
"",
|
|
" if(data.articles.length){",
|
|
" var article = data.articles[0];",
|
|
"",
|
|
" pm.test('Article has \"title\" property', () => {",
|
|
" pm.expect(article).to.have.property('title');",
|
|
" });",
|
|
" pm.test('Article has \"slug\" property', () => {",
|
|
" pm.expect(article).to.have.property('slug');",
|
|
" });",
|
|
" pm.test('Article has \"body\" property', () => {",
|
|
" pm.expect(article).to.have.property('body');",
|
|
" });",
|
|
" pm.test('Article has \"description\" property', () => {",
|
|
" pm.expect(article).to.have.property('description');",
|
|
" });",
|
|
" pm.test('Article has \"tagList\" property', () => {",
|
|
" pm.expect(article).to.have.property('tagList');",
|
|
" });",
|
|
" pm.test('Article\\'s \"tagList\" property is an Array', () => {",
|
|
" pm.expect(article.tagList).to.be.an(\"array\");",
|
|
" });",
|
|
" pm.test('Article has \"favorited\" property', () => {",
|
|
" pm.expect(article).to.have.property('favorited');",
|
|
" });",
|
|
" pm.test('Article has \"favoritesCount\" property', () => {",
|
|
" pm.expect(article).to.have.property('favoritesCount');",
|
|
" });",
|
|
" pm.test('Article\\'s \"favoritesCount\" property is an integer', () => {",
|
|
" pm.expect(article.favoritesCount).to.be.a(\"number\");",
|
|
" });",
|
|
" pm.test('Article has an ISO 8601 timestamp \"createdAt\" property', () => {",
|
|
" pm.expect(article).to.have.property('createdAt');",
|
|
" pm.expect(article.createdAt).to.eql(new Date(article.createdAt).toISOString());",
|
|
" });",
|
|
" pm.test('Article has an ISO 8601 timestamp \"updatedAt\" property', () => {",
|
|
" pm.expect(article).to.have.property('updatedAt');",
|
|
" pm.expect(article.updatedAt).to.eql(new Date(article.updatedAt).toISOString());",
|
|
" });",
|
|
" pm.test('Article has \"author\" property', () => {",
|
|
" pm.expect(article).to.have.property('author');",
|
|
" });",
|
|
" pm.test('Article\\'s \"author\" property has not credential properties', () => {",
|
|
" pm.expect(article.author).not.to.have.property('salt');",
|
|
" pm.expect(article.author).not.to.have.property('hash');",
|
|
" });",
|
|
" } else {",
|
|
" pm.test('articlesCount is 0 when \"articles\" property is empty', () => {",
|
|
" pm.expect(data.articlesCount).to.eql(0);",
|
|
" });",
|
|
" }",
|
|
"}",
|
|
""
|
|
],
|
|
"type": "text/javascript",
|
|
"packages": {}
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "GET",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "X-Requested-With",
|
|
"value": "XMLHttpRequest"
|
|
},
|
|
{
|
|
"key": "Authorization",
|
|
"value": "Token {{token}}"
|
|
}
|
|
],
|
|
"url": {
|
|
"raw": "{{apiUrl}}/articles?favorited=solide",
|
|
"host": [
|
|
"{{apiUrl}}"
|
|
],
|
|
"path": [
|
|
"articles"
|
|
],
|
|
"query": [
|
|
{
|
|
"key": "favorited",
|
|
"value": "solide"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Articles by Tag",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Response code is 200 OK\", () => {",
|
|
" pm.expect(pm.response.code).to.eql(200);",
|
|
"});",
|
|
"",
|
|
"if(pm.response.code === 200){",
|
|
" var responseJSON = JSON.parse(pm.response.text());",
|
|
"",
|
|
" pm.test('Response contains \"data\" property', () => {",
|
|
" pm.expect(responseJSON).to.have.property('data');",
|
|
" });",
|
|
"",
|
|
" var data = responseJSON.data;",
|
|
"",
|
|
" pm.test('Response\\'s \"data\" property contains \"articles\" property', () => {",
|
|
" pm.expect(data).to.have.property('articles');",
|
|
" });",
|
|
" pm.test('data\\'s \"articles\" property is an array', () => {",
|
|
" pm.expect(data.articles).to.be.an(\"array\");",
|
|
" });",
|
|
" pm.test('Response\\'s \"data\" property contains \"articlesCount\" property', () => {",
|
|
" pm.expect(data).to.have.property('articlesCount');",
|
|
" });",
|
|
" pm.test('data\\'s \"articlesCount\" property is an integer', () => {",
|
|
" pm.expect(data.articlesCount).to.be.a(\"number\");",
|
|
" });",
|
|
"",
|
|
" if(data.articles.length){",
|
|
" var article = data.articles[0];",
|
|
"",
|
|
" pm.test('Article has \"title\" property', () => {",
|
|
" pm.expect(article).to.have.property('title');",
|
|
" });",
|
|
" pm.test('Article has \"slug\" property', () => {",
|
|
" pm.expect(article).to.have.property('slug');",
|
|
" });",
|
|
" pm.test('Article has \"body\" property', () => {",
|
|
" pm.expect(article).to.have.property('body');",
|
|
" });",
|
|
" pm.test('Article has \"description\" property', () => {",
|
|
" pm.expect(article).to.have.property('description');",
|
|
" });",
|
|
" pm.test('Article has \"tagList\" property', () => {",
|
|
" pm.expect(article).to.have.property('tagList');",
|
|
" });",
|
|
" pm.test('Article\\'s \"tagList\" property is an Array', () => {",
|
|
" pm.expect(article.tagList).to.be.an(\"array\");",
|
|
" });",
|
|
" pm.test('Article has \"favorited\" property', () => {",
|
|
" pm.expect(article).to.have.property('favorited');",
|
|
" });",
|
|
" pm.test('Article has \"favoritesCount\" property', () => {",
|
|
" pm.expect(article).to.have.property('favoritesCount');",
|
|
" });",
|
|
" pm.test('Article\\'s \"favoritesCount\" property is an integer', () => {",
|
|
" pm.expect(article.favoritesCount).to.be.a(\"number\");",
|
|
" });",
|
|
" pm.test('Article has an ISO 8601 timestamp \"createdAt\" property', () => {",
|
|
" pm.expect(article).to.have.property('createdAt');",
|
|
" pm.expect(article.createdAt).to.eql(new Date(article.createdAt).toISOString());",
|
|
" });",
|
|
" pm.test('Article has an ISO 8601 timestamp \"updatedAt\" property', () => {",
|
|
" pm.expect(article).to.have.property('updatedAt');",
|
|
" pm.expect(article.updatedAt).to.eql(new Date(article.updatedAt).toISOString());",
|
|
" });",
|
|
" pm.test('Article has \"author\" property', () => {",
|
|
" pm.expect(article).to.have.property('author');",
|
|
" });",
|
|
" pm.test('Article\\'s \"author\" property has not credential properties', () => {",
|
|
" pm.expect(article.author).not.to.have.property('salt');",
|
|
" pm.expect(article.author).not.to.have.property('hash');",
|
|
" });",
|
|
" } else {",
|
|
" pm.test('articlesCount is 0 when \"articles\" property is empty', () => {",
|
|
" pm.expect(data.articlesCount).to.eql(0);",
|
|
" });",
|
|
" }",
|
|
"}",
|
|
""
|
|
],
|
|
"type": "text/javascript",
|
|
"packages": {}
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "GET",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "X-Requested-With",
|
|
"value": "XMLHttpRequest"
|
|
}
|
|
],
|
|
"url": {
|
|
"raw": "{{apiUrl}}/articles?tag=CBD",
|
|
"host": [
|
|
"{{apiUrl}}"
|
|
],
|
|
"path": [
|
|
"articles"
|
|
],
|
|
"query": [
|
|
{
|
|
"key": "tag",
|
|
"value": "CBD"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Single Article by slug",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Response code is 200 OK\", () => {",
|
|
" pm.expect(pm.response.code).to.eql(200);",
|
|
"});",
|
|
"",
|
|
"if(pm.response.code === 200){",
|
|
" var responseJSON = JSON.parse(pm.response.text());",
|
|
"",
|
|
" pm.test('Response contains \"article\" property', () => {",
|
|
" pm.expect(responseJSON).to.have.property('article');",
|
|
" });",
|
|
"",
|
|
" var article = responseJSON.article || {};",
|
|
"",
|
|
" pm.test('Article has \"title\" property', () => {",
|
|
" pm.expect(article).to.have.property('title');",
|
|
" });",
|
|
" pm.test('Article has \"slug\" property', () => {",
|
|
" pm.expect(article).to.have.property('slug');",
|
|
" });",
|
|
" pm.test('Article has \"body\" property', () => {",
|
|
" pm.expect(article).to.have.property('body');",
|
|
" });",
|
|
" pm.test('Article has \"description\" property', () => {",
|
|
" pm.expect(article).to.have.property('description');",
|
|
" });",
|
|
" pm.test('Article has \"tagList\" property', () => {",
|
|
" pm.expect(article).to.have.property('tagList');",
|
|
" });",
|
|
" pm.test('Article\\'s \"tagList\" property is an Array', () => {",
|
|
" pm.expect(article.tagList).to.be.an(\"array\");",
|
|
" });",
|
|
" pm.test('Article has \"favorited\" property', () => {",
|
|
" pm.expect(article).to.have.property('favorited');",
|
|
" });",
|
|
" pm.test('Article has \"favoritesCount\" property', () => {",
|
|
" pm.expect(article).to.have.property('favoritesCount');",
|
|
" });",
|
|
" pm.test('Article\\'s \"favoritesCount\" property is an integer', () => {",
|
|
" pm.expect(article.favoritesCount).to.be.a(\"number\");",
|
|
" });",
|
|
" pm.test('Article has an ISO 8601 timestamp \"createdAt\" property', () => {",
|
|
" pm.expect(article).to.have.property('createdAt');",
|
|
" pm.expect(article.createdAt).to.eql(new Date(article.createdAt).toISOString());",
|
|
" });",
|
|
" pm.test('Article has an ISO 8601 timestamp \"updatedAt\" property', () => {",
|
|
" pm.expect(article).to.have.property('updatedAt');",
|
|
" pm.expect(article.updatedAt).to.eql(new Date(article.updatedAt).toISOString());",
|
|
" });",
|
|
" pm.test('Article has \"author\" property', () => {",
|
|
" pm.expect(article).to.have.property('author');",
|
|
" });",
|
|
" pm.test('Article\\'s \"author\" property has not credential properties', () => {",
|
|
" pm.expect(article.author).not.to.have.property('salt');",
|
|
" pm.expect(article.author).not.to.have.property('hash');",
|
|
" });",
|
|
"}",
|
|
""
|
|
],
|
|
"type": "text/javascript",
|
|
"packages": {}
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "GET",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "X-Requested-With",
|
|
"value": "XMLHttpRequest"
|
|
}
|
|
],
|
|
"url": {
|
|
"raw": "{{apiUrl}}/articles/les-molecules",
|
|
"host": [
|
|
"{{apiUrl}}"
|
|
],
|
|
"path": [
|
|
"articles",
|
|
"les-molecules"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "Articles with authentication",
|
|
"item": [
|
|
{
|
|
"name": "Feed",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Response code is 200 OK\", () => {",
|
|
" pm.expect(pm.response.code).to.eql(200);",
|
|
"});",
|
|
"",
|
|
"if(pm.response.code === 200){",
|
|
" var responseJSON = JSON.parse(pm.response.text());",
|
|
"",
|
|
" pm.test('Response contains \"data\" property', () => {",
|
|
" pm.expect(responseJSON).to.have.property('data');",
|
|
" });",
|
|
"",
|
|
" var data = responseJSON.data;",
|
|
"",
|
|
" pm.test('Response\\'s \"data\" property contains \"articles\" property', () => {",
|
|
" pm.expect(data).to.have.property('articles');",
|
|
" });",
|
|
" pm.test('data\\'s \"articles\" property is an array', () => {",
|
|
" pm.expect(data.articles).to.be.an(\"array\");",
|
|
" });",
|
|
" pm.test('Response\\'s \"data\" property contains \"articlesCount\" property', () => {",
|
|
" pm.expect(data).to.have.property('articlesCount');",
|
|
" });",
|
|
" pm.test('data\\'s \"articlesCount\" property is an integer', () => {",
|
|
" pm.expect(data.articlesCount).to.be.a(\"number\");",
|
|
" });",
|
|
"",
|
|
" if(data.articles.length){",
|
|
" var article = data.articles[0];",
|
|
"",
|
|
" pm.test('Article has \"title\" property', () => {",
|
|
" pm.expect(article).to.have.property('title');",
|
|
" });",
|
|
" pm.test('Article has \"slug\" property', () => {",
|
|
" pm.expect(article).to.have.property('slug');",
|
|
" });",
|
|
" pm.test('Article has \"body\" property', () => {",
|
|
" pm.expect(article).to.have.property('body');",
|
|
" });",
|
|
" pm.test('Article has \"description\" property', () => {",
|
|
" pm.expect(article).to.have.property('description');",
|
|
" });",
|
|
" pm.test('Article has \"tagList\" property', () => {",
|
|
" pm.expect(article).to.have.property('tagList');",
|
|
" });",
|
|
" pm.test('Article\\'s \"tagList\" property is an Array', () => {",
|
|
" pm.expect(article.tagList).to.be.an(\"array\");",
|
|
" });",
|
|
" pm.test('Article has \"favorited\" property', () => {",
|
|
" pm.expect(article).to.have.property('favorited');",
|
|
" });",
|
|
" pm.test('Article has \"favoritesCount\" property', () => {",
|
|
" pm.expect(article).to.have.property('favoritesCount');",
|
|
" });",
|
|
" pm.test('Article\\'s \"favoritesCount\" property is an integer', () => {",
|
|
" pm.expect(article.favoritesCount).to.be.a(\"number\");",
|
|
" });",
|
|
" pm.test('Article has an ISO 8601 timestamp \"createdAt\" property', () => {",
|
|
" pm.expect(article).to.have.property('createdAt');",
|
|
" pm.expect(article.createdAt).to.eql(new Date(article.createdAt).toISOString());",
|
|
" });",
|
|
" pm.test('Article has an ISO 8601 timestamp \"updatedAt\" property', () => {",
|
|
" pm.expect(article).to.have.property('updatedAt');",
|
|
" pm.expect(article.updatedAt).to.eql(new Date(article.updatedAt).toISOString());",
|
|
" });",
|
|
" pm.test('Article has \"author\" property', () => {",
|
|
" pm.expect(article).to.have.property('author');",
|
|
" });",
|
|
" pm.test('Article\\'s \"author\" property has not credential properties', () => {",
|
|
" pm.expect(article.author).not.to.have.property('salt');",
|
|
" pm.expect(article.author).not.to.have.property('hash');",
|
|
" });",
|
|
" } else {",
|
|
" pm.test('articlesCount is 0 when \"articles\" property is empty', () => {",
|
|
" pm.expect(data.articlesCount).to.eql(0);",
|
|
" });",
|
|
" }",
|
|
"}",
|
|
""
|
|
],
|
|
"type": "text/javascript",
|
|
"packages": {}
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "GET",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "X-Requested-With",
|
|
"value": "XMLHttpRequest"
|
|
},
|
|
{
|
|
"key": "Authorization",
|
|
"value": "Token {{token}}"
|
|
}
|
|
],
|
|
"url": {
|
|
"raw": "{{apiUrl}}/articles/feed",
|
|
"host": [
|
|
"{{apiUrl}}"
|
|
],
|
|
"path": [
|
|
"articles",
|
|
"feed"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "All Articles",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Response code is 200 OK\", () => {",
|
|
" pm.expect(pm.response.code).to.eql(200);",
|
|
"});",
|
|
"",
|
|
"if(pm.response.code === 200){",
|
|
" var responseJSON = JSON.parse(pm.response.text());",
|
|
"",
|
|
" pm.test('Response contains \"data\" property', () => {",
|
|
" pm.expect(responseJSON).to.have.property('data');",
|
|
" });",
|
|
"",
|
|
" var data = responseJSON.data;",
|
|
"",
|
|
" pm.test('Response\\'s \"data\" property contains \"articles\" property', () => {",
|
|
" pm.expect(data).to.have.property('articles');",
|
|
" });",
|
|
" pm.test('data\\'s \"articles\" property is an array', () => {",
|
|
" pm.expect(data.articles).to.be.an(\"array\");",
|
|
" });",
|
|
" pm.test('Response\\'s \"data\" property contains \"articlesCount\" property', () => {",
|
|
" pm.expect(data).to.have.property('articlesCount');",
|
|
" });",
|
|
" pm.test('data\\'s \"articlesCount\" property is an integer', () => {",
|
|
" pm.expect(data.articlesCount).to.be.a(\"number\");",
|
|
" });",
|
|
"",
|
|
" if(data.articles.length){",
|
|
" var article = data.articles[0];",
|
|
"",
|
|
" pm.test('Article has \"title\" property', () => {",
|
|
" pm.expect(article).to.have.property('title');",
|
|
" });",
|
|
" pm.test('Article has \"slug\" property', () => {",
|
|
" pm.expect(article).to.have.property('slug');",
|
|
" });",
|
|
" pm.test('Article has \"body\" property', () => {",
|
|
" pm.expect(article).to.have.property('body');",
|
|
" });",
|
|
" pm.test('Article has \"description\" property', () => {",
|
|
" pm.expect(article).to.have.property('description');",
|
|
" });",
|
|
" pm.test('Article has \"tagList\" property', () => {",
|
|
" pm.expect(article).to.have.property('tagList');",
|
|
" });",
|
|
" pm.test('Article\\'s \"tagList\" property is an Array', () => {",
|
|
" pm.expect(article.tagList).to.be.an(\"array\");",
|
|
" });",
|
|
" pm.test('Article has \"favorited\" property', () => {",
|
|
" pm.expect(article).to.have.property('favorited');",
|
|
" });",
|
|
" pm.test('Article has \"favoritesCount\" property', () => {",
|
|
" pm.expect(article).to.have.property('favoritesCount');",
|
|
" });",
|
|
" pm.test('Article\\'s \"favoritesCount\" property is an integer', () => {",
|
|
" pm.expect(article.favoritesCount).to.be.a(\"number\");",
|
|
" });",
|
|
" pm.test('Article has an ISO 8601 timestamp \"createdAt\" property', () => {",
|
|
" pm.expect(article).to.have.property('createdAt');",
|
|
" pm.expect(article.createdAt).to.eql(new Date(article.createdAt).toISOString());",
|
|
" });",
|
|
" pm.test('Article has an ISO 8601 timestamp \"updatedAt\" property', () => {",
|
|
" pm.expect(article).to.have.property('updatedAt');",
|
|
" pm.expect(article.updatedAt).to.eql(new Date(article.updatedAt).toISOString());",
|
|
" });",
|
|
" pm.test('Article has \"author\" property', () => {",
|
|
" pm.expect(article).to.have.property('author');",
|
|
" });",
|
|
" pm.test('Article\\'s \"author\" property has not credential properties', () => {",
|
|
" pm.expect(article.author).not.to.have.property('salt');",
|
|
" pm.expect(article.author).not.to.have.property('hash');",
|
|
" });",
|
|
" } else {",
|
|
" pm.test('articlesCount is 0 when \"articles\" property is empty', () => {",
|
|
" pm.expect(data.articlesCount).to.eql(0);",
|
|
" });",
|
|
" }",
|
|
"}",
|
|
""
|
|
],
|
|
"type": "text/javascript",
|
|
"packages": {}
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "GET",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "X-Requested-With",
|
|
"value": "XMLHttpRequest"
|
|
},
|
|
{
|
|
"key": "Authorization",
|
|
"value": "Token {{token}}"
|
|
}
|
|
],
|
|
"url": {
|
|
"raw": "{{apiUrl}}/articles",
|
|
"host": [
|
|
"{{apiUrl}}"
|
|
],
|
|
"path": [
|
|
"articles"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Articles by Author",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Response code is 200 OK\", () => {",
|
|
" pm.expect(pm.response.code).to.eql(200);",
|
|
"});",
|
|
"",
|
|
"if(pm.response.code === 200){",
|
|
" var responseJSON = JSON.parse(pm.response.text());",
|
|
"",
|
|
" pm.test('Response contains \"data\" property', () => {",
|
|
" pm.expect(responseJSON).to.have.property('data');",
|
|
" });",
|
|
"",
|
|
" var data = responseJSON.data;",
|
|
"",
|
|
" pm.test('Response\\'s \"data\" property contains \"articles\" property', () => {",
|
|
" pm.expect(data).to.have.property('articles');",
|
|
" });",
|
|
" pm.test('data\\'s \"articles\" property is an array', () => {",
|
|
" pm.expect(data.articles).to.be.an(\"array\");",
|
|
" });",
|
|
" pm.test('Response\\'s \"data\" property contains \"articlesCount\" property', () => {",
|
|
" pm.expect(data).to.have.property('articlesCount');",
|
|
" });",
|
|
" pm.test('data\\'s \"articlesCount\" property is an integer', () => {",
|
|
" pm.expect(data.articlesCount).to.be.a(\"number\");",
|
|
" });",
|
|
"",
|
|
" if(data.articles.length){",
|
|
" var article = data.articles[0];",
|
|
"",
|
|
" pm.test('Article has \"title\" property', () => {",
|
|
" pm.expect(article).to.have.property('title');",
|
|
" });",
|
|
" pm.test('Article has \"slug\" property', () => {",
|
|
" pm.expect(article).to.have.property('slug');",
|
|
" });",
|
|
" pm.test('Article has \"body\" property', () => {",
|
|
" pm.expect(article).to.have.property('body');",
|
|
" });",
|
|
" pm.test('Article has \"description\" property', () => {",
|
|
" pm.expect(article).to.have.property('description');",
|
|
" });",
|
|
" pm.test('Article has \"tagList\" property', () => {",
|
|
" pm.expect(article).to.have.property('tagList');",
|
|
" });",
|
|
" pm.test('Article\\'s \"tagList\" property is an Array', () => {",
|
|
" pm.expect(article.tagList).to.be.an(\"array\");",
|
|
" });",
|
|
" pm.test('Article has \"favorited\" property', () => {",
|
|
" pm.expect(article).to.have.property('favorited');",
|
|
" });",
|
|
" pm.test('Article has \"favoritesCount\" property', () => {",
|
|
" pm.expect(article).to.have.property('favoritesCount');",
|
|
" });",
|
|
" pm.test('Article\\'s \"favoritesCount\" property is an integer', () => {",
|
|
" pm.expect(article.favoritesCount).to.be.a(\"number\");",
|
|
" });",
|
|
" pm.test('Article has an ISO 8601 timestamp \"createdAt\" property', () => {",
|
|
" pm.expect(article).to.have.property('createdAt');",
|
|
" pm.expect(article.createdAt).to.eql(new Date(article.createdAt).toISOString());",
|
|
" });",
|
|
" pm.test('Article has an ISO 8601 timestamp \"updatedAt\" property', () => {",
|
|
" pm.expect(article).to.have.property('updatedAt');",
|
|
" pm.expect(article.updatedAt).to.eql(new Date(article.updatedAt).toISOString());",
|
|
" });",
|
|
" pm.test('Article has \"author\" property', () => {",
|
|
" pm.expect(article).to.have.property('author');",
|
|
" });",
|
|
" pm.test('Article\\'s \"author\" property has not credential properties', () => {",
|
|
" pm.expect(article.author).not.to.have.property('salt');",
|
|
" pm.expect(article.author).not.to.have.property('hash');",
|
|
" });",
|
|
" } else {",
|
|
" pm.test('articlesCount is 0 when \"articles\" property is empty', () => {",
|
|
" pm.expect(data.articlesCount).to.eql(0);",
|
|
" });",
|
|
" }",
|
|
"}",
|
|
""
|
|
],
|
|
"type": "text/javascript",
|
|
"packages": {}
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "GET",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "X-Requested-With",
|
|
"value": "XMLHttpRequest"
|
|
},
|
|
{
|
|
"key": "Authorization",
|
|
"value": "Token {{token}}"
|
|
}
|
|
],
|
|
"url": {
|
|
"raw": "{{apiUrl}}/articles?author=solide",
|
|
"host": [
|
|
"{{apiUrl}}"
|
|
],
|
|
"path": [
|
|
"articles"
|
|
],
|
|
"query": [
|
|
{
|
|
"key": "author",
|
|
"value": "solide"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Articles Favorited by Username",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Response code is 200 OK\", () => {",
|
|
" pm.expect(pm.response.code).to.eql(200);",
|
|
"});",
|
|
"",
|
|
"if(pm.response.code === 200){",
|
|
" var responseJSON = JSON.parse(pm.response.text());",
|
|
"",
|
|
" pm.test('Response contains \"data\" property', () => {",
|
|
" pm.expect(responseJSON).to.have.property('data');",
|
|
" });",
|
|
"",
|
|
" var data = responseJSON.data;",
|
|
"",
|
|
" pm.test('Response\\'s \"data\" property contains \"articles\" property', () => {",
|
|
" pm.expect(data).to.have.property('articles');",
|
|
" });",
|
|
" pm.test('data\\'s \"articles\" property is an array', () => {",
|
|
" pm.expect(data.articles).to.be.an(\"array\");",
|
|
" });",
|
|
" pm.test('Response\\'s \"data\" property contains \"articlesCount\" property', () => {",
|
|
" pm.expect(data).to.have.property('articlesCount');",
|
|
" });",
|
|
" pm.test('data\\'s \"articlesCount\" property is an integer', () => {",
|
|
" pm.expect(data.articlesCount).to.be.a(\"number\");",
|
|
" });",
|
|
"",
|
|
" if(data.articles.length){",
|
|
" var article = data.articles[0];",
|
|
"",
|
|
" pm.test('Article has \"title\" property', () => {",
|
|
" pm.expect(article).to.have.property('title');",
|
|
" });",
|
|
" pm.test('Article has \"slug\" property', () => {",
|
|
" pm.expect(article).to.have.property('slug');",
|
|
" });",
|
|
" pm.test('Article has \"body\" property', () => {",
|
|
" pm.expect(article).to.have.property('body');",
|
|
" });",
|
|
" pm.test('Article has \"description\" property', () => {",
|
|
" pm.expect(article).to.have.property('description');",
|
|
" });",
|
|
" pm.test('Article has \"tagList\" property', () => {",
|
|
" pm.expect(article).to.have.property('tagList');",
|
|
" });",
|
|
" pm.test('Article\\'s \"tagList\" property is an Array', () => {",
|
|
" pm.expect(article.tagList).to.be.an(\"array\");",
|
|
" });",
|
|
" pm.test('Article has \"favorited\" property', () => {",
|
|
" pm.expect(article).to.have.property('favorited');",
|
|
" });",
|
|
" pm.test('Article has \"favoritesCount\" property', () => {",
|
|
" pm.expect(article).to.have.property('favoritesCount');",
|
|
" });",
|
|
" pm.test('Article\\'s \"favoritesCount\" property is an integer', () => {",
|
|
" pm.expect(article.favoritesCount).to.be.a(\"number\");",
|
|
" });",
|
|
" pm.test('Article has an ISO 8601 timestamp \"createdAt\" property', () => {",
|
|
" pm.expect(article).to.have.property('createdAt');",
|
|
" pm.expect(article.createdAt).to.eql(new Date(article.createdAt).toISOString());",
|
|
" });",
|
|
" pm.test('Article has an ISO 8601 timestamp \"updatedAt\" property', () => {",
|
|
" pm.expect(article).to.have.property('updatedAt');",
|
|
" pm.expect(article.updatedAt).to.eql(new Date(article.updatedAt).toISOString());",
|
|
" });",
|
|
" pm.test('Article has \"author\" property', () => {",
|
|
" pm.expect(article).to.have.property('author');",
|
|
" });",
|
|
" pm.test('Article\\'s \"author\" property has not credential properties', () => {",
|
|
" pm.expect(article.author).not.to.have.property('salt');",
|
|
" pm.expect(article.author).not.to.have.property('hash');",
|
|
" });",
|
|
" } else {",
|
|
" pm.test('articlesCount is 0 when \"articles\" property is empty', () => {",
|
|
" pm.expect(data.articlesCount).to.eql(0);",
|
|
" });",
|
|
" }",
|
|
"}",
|
|
""
|
|
],
|
|
"type": "text/javascript",
|
|
"packages": {}
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "GET",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "X-Requested-With",
|
|
"value": "XMLHttpRequest"
|
|
},
|
|
{
|
|
"key": "Authorization",
|
|
"value": "Token {{token}}"
|
|
}
|
|
],
|
|
"url": {
|
|
"raw": "{{apiUrl}}/articles?favorited=solide",
|
|
"host": [
|
|
"{{apiUrl}}"
|
|
],
|
|
"path": [
|
|
"articles"
|
|
],
|
|
"query": [
|
|
{
|
|
"key": "favorited",
|
|
"value": "solide"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Create Article",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Response code is 201 Created\", () => {",
|
|
" pm.expect(pm.response.code).to.eql(201);",
|
|
"});",
|
|
"",
|
|
"if(pm.response.code === 201){",
|
|
" var responseJSON = JSON.parse(pm.response.text());",
|
|
"",
|
|
" pm.test('Response contains \"article\" property', () => {",
|
|
" pm.expect(responseJSON).to.have.property('article');",
|
|
" });",
|
|
"",
|
|
" var article = responseJSON.article || {};",
|
|
"",
|
|
" pm.test('Article has \"title\" property', () => {",
|
|
" pm.expect(article).to.have.property('title');",
|
|
" });",
|
|
" pm.test('Article has \"slug\" property', () => {",
|
|
" try {",
|
|
" pm.expect(article).to.have.property('slug');",
|
|
" } catch (e) {",
|
|
" throw (e);",
|
|
" }",
|
|
" pm.collectionVariables.set('slug', article.slug);",
|
|
" });",
|
|
" pm.test('Article has \"body\" property', () => {",
|
|
" pm.expect(article).to.have.property('body');",
|
|
" });",
|
|
" pm.test('Article has \"description\" property', () => {",
|
|
" pm.expect(article).to.have.property('description');",
|
|
" });",
|
|
" pm.test('Article has \"tagList\" property', () => {",
|
|
" pm.expect(article).to.have.property('tagList');",
|
|
" });",
|
|
" pm.test('Article\\'s \"tagList\" property is an Array', () => {",
|
|
" pm.expect(article.tagList).to.be.an(\"array\");",
|
|
" });",
|
|
" pm.test('Article has \"favorited\" property', () => {",
|
|
" pm.expect(article).to.have.property('favorited');",
|
|
" });",
|
|
" pm.test('Article has \"favoritesCount\" property', () => {",
|
|
" pm.expect(article).to.have.property('favoritesCount');",
|
|
" });",
|
|
" pm.test('Article\\'s \"favoritesCount\" property is an integer', () => {",
|
|
" pm.expect(article.favoritesCount).to.be.a(\"number\");",
|
|
" });",
|
|
" pm.test('Article has an ISO 8601 timestamp \"createdAt\" property', () => {",
|
|
" pm.expect(article).to.have.property('createdAt');",
|
|
" pm.expect(article.createdAt).to.eql(new Date(article.createdAt).toISOString());",
|
|
" });",
|
|
" pm.test('Article has an ISO 8601 timestamp \"updatedAt\" property', () => {",
|
|
" pm.expect(article).to.have.property('updatedAt');",
|
|
" pm.expect(article.updatedAt).to.eql(new Date(article.updatedAt).toISOString());",
|
|
" });",
|
|
" pm.test('Article has \"author\" property', () => {",
|
|
" pm.expect(article).to.have.property('author');",
|
|
" });",
|
|
" pm.test('Article\\'s \"author\" property has not credential properties', () => {",
|
|
" pm.expect(article.author).not.to.have.property('salt');",
|
|
" pm.expect(article.author).not.to.have.property('hash');",
|
|
" });",
|
|
"}",
|
|
""
|
|
],
|
|
"type": "text/javascript",
|
|
"packages": {}
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "X-Requested-With",
|
|
"value": "XMLHttpRequest"
|
|
},
|
|
{
|
|
"key": "Authorization",
|
|
"value": "Token {{token}}"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"article\": {\n \"title\": \"How to tame an octopus\",\n \"description\": \"Ever wonder how?\",\n \"body\": \"Very carefully.\",\n \"tagList\": [\n \"octopus\",\n \"training\"\n ]\n }\n}"
|
|
},
|
|
"url": {
|
|
"raw": "{{apiUrl}}/articles",
|
|
"host": [
|
|
"{{apiUrl}}"
|
|
],
|
|
"path": [
|
|
"articles"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Articles by Tag",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Response code is 200 OK\", () => {",
|
|
" pm.expect(pm.response.code).to.eql(200);",
|
|
"});",
|
|
"",
|
|
"if(pm.response.code === 200){",
|
|
" var responseJSON = JSON.parse(pm.response.text());",
|
|
"",
|
|
" pm.test('Response contains \"data\" property', () => {",
|
|
" pm.expect(responseJSON).to.have.property('data');",
|
|
" });",
|
|
"",
|
|
" var data = responseJSON.data;",
|
|
"",
|
|
" pm.test('Response\\'s \"data\" property contains \"articles\" property', () => {",
|
|
" pm.expect(data).to.have.property('articles');",
|
|
" });",
|
|
" pm.test('data\\'s \"articles\" property is an array', () => {",
|
|
" pm.expect(data.articles).to.be.an(\"array\");",
|
|
" });",
|
|
" pm.test('Response\\'s \"data\" property contains \"articlesCount\" property', () => {",
|
|
" pm.expect(data).to.have.property('articlesCount');",
|
|
" });",
|
|
" pm.test('data\\'s \"articlesCount\" property is an integer', () => {",
|
|
" pm.expect(data.articlesCount).to.be.a(\"number\");",
|
|
" });",
|
|
"",
|
|
" if(data.articles.length){",
|
|
" var article = data.articles[0];",
|
|
"",
|
|
" pm.test('Article has \"title\" property', () => {",
|
|
" pm.expect(article).to.have.property('title');",
|
|
" });",
|
|
" pm.test('Article has \"slug\" property', () => {",
|
|
" pm.expect(article).to.have.property('slug');",
|
|
" });",
|
|
" pm.test('Article has \"body\" property', () => {",
|
|
" pm.expect(article).to.have.property('body');",
|
|
" });",
|
|
" pm.test('Article has \"description\" property', () => {",
|
|
" pm.expect(article).to.have.property('description');",
|
|
" });",
|
|
" pm.test('Article has \"tagList\" property', () => {",
|
|
" pm.expect(article).to.have.property('tagList');",
|
|
" });",
|
|
" pm.test('Article\\'s \"tagList\" property is an Array', () => {",
|
|
" pm.expect(article.tagList).to.be.an(\"array\");",
|
|
" });",
|
|
" pm.test('Article has \"favorited\" property', () => {",
|
|
" pm.expect(article).to.have.property('favorited');",
|
|
" });",
|
|
" pm.test('Article has \"favoritesCount\" property', () => {",
|
|
" pm.expect(article).to.have.property('favoritesCount');",
|
|
" });",
|
|
" pm.test('Article\\'s \"favoritesCount\" property is an integer', () => {",
|
|
" pm.expect(article.favoritesCount).to.be.a(\"number\");",
|
|
" });",
|
|
" pm.test('Article has an ISO 8601 timestamp \"createdAt\" property', () => {",
|
|
" pm.expect(article).to.have.property('createdAt');",
|
|
" pm.expect(article.createdAt).to.eql(new Date(article.createdAt).toISOString());",
|
|
" });",
|
|
" pm.test('Article has an ISO 8601 timestamp \"updatedAt\" property', () => {",
|
|
" pm.expect(article).to.have.property('updatedAt');",
|
|
" pm.expect(article.updatedAt).to.eql(new Date(article.updatedAt).toISOString());",
|
|
" });",
|
|
" pm.test('Article has \"author\" property', () => {",
|
|
" pm.expect(article).to.have.property('author');",
|
|
" });",
|
|
" pm.test('Article\\'s \"author\" property has not credential properties', () => {",
|
|
" pm.expect(article.author).not.to.have.property('salt');",
|
|
" pm.expect(article.author).not.to.have.property('hash');",
|
|
" });",
|
|
" } else {",
|
|
" pm.test('articlesCount is 0 when \"articles\" property is empty', () => {",
|
|
" pm.expect(data.articlesCount).to.eql(0);",
|
|
" });",
|
|
" }",
|
|
"}",
|
|
""
|
|
],
|
|
"type": "text/javascript",
|
|
"packages": {}
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "GET",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "X-Requested-With",
|
|
"value": "XMLHttpRequest"
|
|
},
|
|
{
|
|
"key": "Authorization",
|
|
"value": "Token {{token}}"
|
|
}
|
|
],
|
|
"url": {
|
|
"raw": "{{apiUrl}}/articles?tag=octopus",
|
|
"host": [
|
|
"{{apiUrl}}"
|
|
],
|
|
"path": [
|
|
"articles"
|
|
],
|
|
"query": [
|
|
{
|
|
"key": "tag",
|
|
"value": "octopus"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Single Article by slug",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Response code is 200 OK\", () => {",
|
|
" pm.expect(pm.response.code).to.eql(200);",
|
|
"});",
|
|
"",
|
|
"if(pm.response.code === 200){",
|
|
" var responseJSON = JSON.parse(pm.response.text());",
|
|
"",
|
|
" pm.test('Response contains \"article\" property', () => {",
|
|
" pm.expect(responseJSON).to.have.property('article');",
|
|
" });",
|
|
"",
|
|
" var article = responseJSON.article || {};",
|
|
"",
|
|
" pm.test('Article has \"title\" property', () => {",
|
|
" pm.expect(article).to.have.property('title');",
|
|
" });",
|
|
" pm.test('Article has \"slug\" property', () => {",
|
|
" pm.expect(article).to.have.property('slug');",
|
|
" });",
|
|
" pm.test('Article has \"body\" property', () => {",
|
|
" pm.expect(article).to.have.property('body');",
|
|
" });",
|
|
" pm.test('Article has \"description\" property', () => {",
|
|
" pm.expect(article).to.have.property('description');",
|
|
" });",
|
|
" pm.test('Article has \"tagList\" property', () => {",
|
|
" pm.expect(article).to.have.property('tagList');",
|
|
" });",
|
|
" pm.test('Article\\'s \"tagList\" property is an Array', () => {",
|
|
" pm.expect(article.tagList).to.be.an(\"array\");",
|
|
" });",
|
|
" pm.test('Article has \"favorited\" property', () => {",
|
|
" pm.expect(article).to.have.property('favorited');",
|
|
" });",
|
|
" pm.test('Article has \"favoritesCount\" property', () => {",
|
|
" pm.expect(article).to.have.property('favoritesCount');",
|
|
" });",
|
|
" pm.test('Article\\'s \"favoritesCount\" property is an integer', () => {",
|
|
" pm.expect(article.favoritesCount).to.be.a(\"number\");",
|
|
" });",
|
|
" pm.test('Article has an ISO 8601 timestamp \"createdAt\" property', () => {",
|
|
" pm.expect(article).to.have.property('createdAt');",
|
|
" pm.expect(article.createdAt).to.eql(new Date(article.createdAt).toISOString());",
|
|
" });",
|
|
" pm.test('Article has an ISO 8601 timestamp \"updatedAt\" property', () => {",
|
|
" pm.expect(article).to.have.property('updatedAt');",
|
|
" pm.expect(article.updatedAt).to.eql(new Date(article.updatedAt).toISOString());",
|
|
" });",
|
|
" pm.test('Article has \"author\" property', () => {",
|
|
" pm.expect(article).to.have.property('author');",
|
|
" });",
|
|
" pm.test('Article\\'s \"author\" property has not credential properties', () => {",
|
|
" pm.expect(article.author).not.to.have.property('salt');",
|
|
" pm.expect(article.author).not.to.have.property('hash');",
|
|
" });",
|
|
"}",
|
|
""
|
|
],
|
|
"type": "text/javascript",
|
|
"packages": {}
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "GET",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "X-Requested-With",
|
|
"value": "XMLHttpRequest"
|
|
},
|
|
{
|
|
"key": "Authorization",
|
|
"value": "Token {{token}}"
|
|
}
|
|
],
|
|
"url": {
|
|
"raw": "{{apiUrl}}/articles/{{slug}}",
|
|
"host": [
|
|
"{{apiUrl}}"
|
|
],
|
|
"path": [
|
|
"articles",
|
|
"{{slug}}"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Update Article",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
"if (!(environment.isIntegrationTest)) {",
|
|
"var responseJSON = JSON.parse(responseBody);",
|
|
"",
|
|
"tests['Response contains \"article\" property'] = responseJSON.hasOwnProperty('article');",
|
|
"",
|
|
"var article = responseJSON.article || {};",
|
|
"",
|
|
"tests['Article has \"title\" property'] = article.hasOwnProperty('title');",
|
|
"tests['Article has \"slug\" property'] = article.hasOwnProperty('slug');",
|
|
"tests['Article has \"body\" property'] = article.hasOwnProperty('body');",
|
|
"tests['Article has \"createdAt\" property'] = article.hasOwnProperty('createdAt');",
|
|
"tests['Article\\'s \"createdAt\" property is an ISO 8601 timestamp'] = new Date(article.createdAt).toISOString() === article.createdAt;",
|
|
"tests['Article has \"updatedAt\" property'] = article.hasOwnProperty('updatedAt');",
|
|
"tests['Article\\'s \"updatedAt\" property is an ISO 8601 timestamp'] = new Date(article.updatedAt).toISOString() === article.updatedAt;",
|
|
"tests['Article has \"description\" property'] = article.hasOwnProperty('description');",
|
|
"tests['Article has \"tagList\" property'] = article.hasOwnProperty('tagList');",
|
|
"tests['Article\\'s \"tagList\" property is an Array'] = Array.isArray(article.tagList);",
|
|
"tests['Article has \"author\" property'] = article.hasOwnProperty('author');",
|
|
"tests['Article has \"favorited\" property'] = article.hasOwnProperty('favorited');",
|
|
"tests['Article has \"favoritesCount\" property'] = article.hasOwnProperty('favoritesCount');",
|
|
"tests['favoritesCount is an integer'] = Number.isInteger(article.favoritesCount);",
|
|
"}",
|
|
""
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "PUT",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "X-Requested-With",
|
|
"value": "XMLHttpRequest"
|
|
},
|
|
{
|
|
"key": "Authorization",
|
|
"value": "Token {{token}}"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\"article\":{\"body\":\"With two hands\"}}"
|
|
},
|
|
"url": {
|
|
"raw": "{{apiUrl}}/articles/{{slug}}",
|
|
"host": [
|
|
"{{apiUrl}}"
|
|
],
|
|
"path": [
|
|
"articles",
|
|
"{{slug}}"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Favorite Article",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
"var responseJSON = JSON.parse(responseBody);",
|
|
"",
|
|
"tests['Response contains \"article\" property'] = responseJSON.hasOwnProperty('article');",
|
|
"",
|
|
"var article = responseJSON.article || {};",
|
|
"",
|
|
"tests['Article has \"title\" property'] = article.hasOwnProperty('title');",
|
|
"tests['Article has \"slug\" property'] = article.hasOwnProperty('slug');",
|
|
"tests['Article has \"body\" property'] = article.hasOwnProperty('body');",
|
|
"tests['Article has \"createdAt\" property'] = article.hasOwnProperty('createdAt');",
|
|
"tests['Article\\'s \"createdAt\" property is an ISO 8601 timestamp'] = new Date(article.createdAt).toISOString() === article.createdAt;",
|
|
"tests['Article has \"updatedAt\" property'] = article.hasOwnProperty('updatedAt');",
|
|
"tests['Article\\'s \"updatedAt\" property is an ISO 8601 timestamp'] = new Date(article.updatedAt).toISOString() === article.updatedAt;",
|
|
"tests['Article has \"description\" property'] = article.hasOwnProperty('description');",
|
|
"tests['Article has \"tagList\" property'] = article.hasOwnProperty('tagList');",
|
|
"tests['Article\\'s \"tagList\" property is an Array'] = Array.isArray(article.tagList);",
|
|
"tests['Article has \"author\" property'] = article.hasOwnProperty('author');",
|
|
"tests['Article has \"favorited\" property'] = article.hasOwnProperty('favorited');",
|
|
"tests[\"Article's 'favorited' property is true\"] = article.favorited === true;",
|
|
"tests['Article has \"favoritesCount\" property'] = article.hasOwnProperty('favoritesCount');",
|
|
"tests['favoritesCount is an integer'] = Number.isInteger(article.favoritesCount);",
|
|
"tests[\"Article's 'favoritesCount' property is greater than 0\"] = article.favoritesCount > 0;",
|
|
""
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "X-Requested-With",
|
|
"value": "XMLHttpRequest"
|
|
},
|
|
{
|
|
"key": "Authorization",
|
|
"value": "Token {{token}}"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": ""
|
|
},
|
|
"url": {
|
|
"raw": "{{apiUrl}}/articles/{{slug}}/favorite",
|
|
"host": [
|
|
"{{apiUrl}}"
|
|
],
|
|
"path": [
|
|
"articles",
|
|
"{{slug}}",
|
|
"favorite"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Unfavorite Article",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
"var responseJSON = JSON.parse(responseBody);",
|
|
"",
|
|
"tests['Response contains \"article\" property'] = responseJSON.hasOwnProperty('article');",
|
|
"",
|
|
"var article = responseJSON.article || {};",
|
|
"",
|
|
"tests['Article has \"title\" property'] = article.hasOwnProperty('title');",
|
|
"tests['Article has \"slug\" property'] = article.hasOwnProperty('slug');",
|
|
"tests['Article has \"body\" property'] = article.hasOwnProperty('body');",
|
|
"tests['Article has \"createdAt\" property'] = article.hasOwnProperty('createdAt');",
|
|
"tests['Article\\'s \"createdAt\" property is an ISO 8601 timestamp'] = new Date(article.createdAt).toISOString() === article.createdAt;",
|
|
"tests['Article has \"updatedAt\" property'] = article.hasOwnProperty('updatedAt');",
|
|
"tests['Article\\'s \"updatedAt\" property is an ISO 8601 timestamp'] = new Date(article.updatedAt).toISOString() === article.updatedAt;",
|
|
"tests['Article has \"description\" property'] = article.hasOwnProperty('description');",
|
|
"tests['Article has \"tagList\" property'] = article.hasOwnProperty('tagList');",
|
|
"tests['Article\\'s \"tagList\" property is an Array'] = Array.isArray(article.tagList);",
|
|
"tests['Article has \"author\" property'] = article.hasOwnProperty('author');",
|
|
"tests['Article has \"favorited\" property'] = article.hasOwnProperty('favorited');",
|
|
"tests['Article has \"favoritesCount\" property'] = article.hasOwnProperty('favoritesCount');",
|
|
"tests['favoritesCount is an integer'] = Number.isInteger(article.favoritesCount);",
|
|
"tests[\"Article's \\\"favorited\\\" property is true\"] = article.favorited === false;",
|
|
""
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "DELETE",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "X-Requested-With",
|
|
"value": "XMLHttpRequest"
|
|
},
|
|
{
|
|
"key": "Authorization",
|
|
"value": "Token {{token}}"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": ""
|
|
},
|
|
"url": {
|
|
"raw": "{{apiUrl}}/articles/{{slug}}/favorite",
|
|
"host": [
|
|
"{{apiUrl}}"
|
|
],
|
|
"path": [
|
|
"articles",
|
|
"{{slug}}",
|
|
"favorite"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "Comments",
|
|
"item": [
|
|
{
|
|
"name": "All Comments for Article",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
"var is200Response = responseCode.code === 200",
|
|
"",
|
|
"tests['Response code is 200 OK'] = is200Response;",
|
|
"",
|
|
"if(is200Response){",
|
|
" var responseJSON = JSON.parse(responseBody);",
|
|
"",
|
|
" tests['Response contains \"comments\" property'] = responseJSON.hasOwnProperty('comments');",
|
|
"",
|
|
" if(responseJSON.comments.length){",
|
|
" var comment = responseJSON.comments[0];",
|
|
"",
|
|
" tests['Comment has \"id\" property'] = comment.hasOwnProperty('id');",
|
|
" tests['Comment has \"body\" property'] = comment.hasOwnProperty('body');",
|
|
" tests['Comment has \"createdAt\" property'] = comment.hasOwnProperty('createdAt');",
|
|
" tests['\"createdAt\" property is an ISO 8601 timestamp'] = new Date(comment.createdAt).toISOString() === comment.createdAt;",
|
|
" tests['Comment has \"updatedAt\" property'] = comment.hasOwnProperty('updatedAt');",
|
|
" tests['\"updatedAt\" property is an ISO 8601 timestamp'] = new Date(comment.updatedAt).toISOString() === comment.updatedAt;",
|
|
" tests['Comment has \"author\" property'] = comment.hasOwnProperty('author');",
|
|
" }",
|
|
"}",
|
|
""
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "GET",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "X-Requested-With",
|
|
"value": "XMLHttpRequest"
|
|
},
|
|
{
|
|
"key": "Authorization",
|
|
"value": "Token {{token}}"
|
|
}
|
|
],
|
|
"url": {
|
|
"raw": "{{apiUrl}}/articles/{{slug}}/comments",
|
|
"host": [
|
|
"{{apiUrl}}"
|
|
],
|
|
"path": [
|
|
"articles",
|
|
"{{slug}}",
|
|
"comments"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Create Comment for Article",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
"var responseJSON = JSON.parse(responseBody);",
|
|
"",
|
|
"tests['Response contains \"comment\" property'] = responseJSON.hasOwnProperty('comment');",
|
|
"",
|
|
"var comment = responseJSON.comment || {};",
|
|
"",
|
|
"tests['Comment has \"id\" property'] = comment.hasOwnProperty('id');",
|
|
"tests['Comment has \"body\" property'] = comment.hasOwnProperty('body');",
|
|
"tests['Comment has \"createdAt\" property'] = comment.hasOwnProperty('createdAt');",
|
|
"tests['\"createdAt\" property is an ISO 8601 timestamp'] = new Date(comment.createdAt).toISOString() === comment.createdAt;",
|
|
"tests['Comment has \"author\" property'] = comment.hasOwnProperty('author');",
|
|
""
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "X-Requested-With",
|
|
"value": "XMLHttpRequest"
|
|
},
|
|
{
|
|
"key": "Authorization",
|
|
"value": "Token {{token}}"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\"comment\":{\"body\":\"Thank you so much!\"}}"
|
|
},
|
|
"url": {
|
|
"raw": "{{apiUrl}}/articles/{{slug}}/comments",
|
|
"host": [
|
|
"{{apiUrl}}"
|
|
],
|
|
"path": [
|
|
"articles",
|
|
"{{slug}}",
|
|
"comments"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Delete Comment for Article",
|
|
"request": {
|
|
"method": "DELETE",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "X-Requested-With",
|
|
"value": "XMLHttpRequest"
|
|
},
|
|
{
|
|
"key": "Authorization",
|
|
"value": "Token {{token}}"
|
|
}
|
|
],
|
|
"url": {
|
|
"raw": "{{apiUrl}}/articles/{{slug}}/comments/1",
|
|
"host": [
|
|
"{{apiUrl}}"
|
|
],
|
|
"path": [
|
|
"articles",
|
|
"{{slug}}",
|
|
"comments",
|
|
"1"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "Profiles",
|
|
"item": [
|
|
{
|
|
"name": "Profile",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"if (!(pm.environment.get('isIntegrationTest'))) {",
|
|
" pm.test(\"Response code is 200 OK\", () => {",
|
|
" pm.expect(pm.response.code).to.eql(200);",
|
|
" });",
|
|
"",
|
|
" if(pm.response.code === 200){",
|
|
" var responseJSON = JSON.parse(pm.response.text());",
|
|
"",
|
|
" pm.test('Response contains \"profile\" property', () => {",
|
|
" pm.expect(responseJSON).to.have.property('profile');",
|
|
" });",
|
|
" ",
|
|
" var profile = responseJSON.profile || {};",
|
|
"",
|
|
" pm.test('Profile has \"username\" property', () => {",
|
|
" pm.expect(profile).to.have.property('username');",
|
|
" });",
|
|
" pm.test('Profile has \"image\" property', () => {",
|
|
" pm.expect(profile).to.have.property('image');",
|
|
" });",
|
|
" pm.test('Profile has \"following\" property', () => {",
|
|
" pm.expect(profile).to.have.property('following');",
|
|
" });",
|
|
" }",
|
|
"}",
|
|
""
|
|
],
|
|
"type": "text/javascript",
|
|
"packages": {}
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "GET",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "X-Requested-With",
|
|
"value": "XMLHttpRequest"
|
|
},
|
|
{
|
|
"key": "Authorization",
|
|
"value": "Token {{token}}"
|
|
}
|
|
],
|
|
"url": {
|
|
"raw": "{{apiUrl}}/profiles/annehonime",
|
|
"host": [
|
|
"{{apiUrl}}"
|
|
],
|
|
"path": [
|
|
"profiles",
|
|
"annehonime"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Follow Profile",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"if (!(pm.environment.get('isIntegrationTest'))) {",
|
|
" pm.test(\"Response code is 200 OK\", () => {",
|
|
" pm.expect(pm.response.code).to.eql(200);",
|
|
" });",
|
|
"",
|
|
" if(pm.response.code === 200){",
|
|
" var responseJSON = JSON.parse(pm.response.text());",
|
|
"",
|
|
" pm.test('Response contains \"profile\" property', () => {",
|
|
" pm.expect(responseJSON).to.have.property('profile');",
|
|
" });",
|
|
" ",
|
|
" var profile = responseJSON.profile || {};",
|
|
"",
|
|
" pm.test('Profile has \"username\" property', () => {",
|
|
" pm.expect(profile).to.have.property('username');",
|
|
" });",
|
|
" pm.test('Profile has \"image\" property', () => {",
|
|
" pm.expect(profile).to.have.property('image');",
|
|
" });",
|
|
" pm.test('Profile has \"following\" property', () => {",
|
|
" pm.expect(profile).to.have.property('following');",
|
|
" });",
|
|
" pm.test('Profile\\'s \"following\" property is true', () => {",
|
|
" pm.expect(profile.following).to.eql(true);",
|
|
" });",
|
|
" }",
|
|
"}",
|
|
""
|
|
],
|
|
"type": "text/javascript",
|
|
"packages": {}
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "X-Requested-With",
|
|
"value": "XMLHttpRequest"
|
|
},
|
|
{
|
|
"key": "Authorization",
|
|
"value": "Token {{token}}"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\"user\":{\"email\":\"anne@honime.com\"}}"
|
|
},
|
|
"url": {
|
|
"raw": "{{apiUrl}}/profiles/annehonime/follow",
|
|
"host": [
|
|
"{{apiUrl}}"
|
|
],
|
|
"path": [
|
|
"profiles",
|
|
"annehonime",
|
|
"follow"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "Unfollow Profile",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"if (!(pm.environment.get('isIntegrationTest'))) {",
|
|
" pm.test(\"Response code is 200 OK\", () => {",
|
|
" pm.expect(pm.response.code).to.eql(200);",
|
|
" });",
|
|
"",
|
|
" if(pm.response.code === 200){",
|
|
" var responseJSON = JSON.parse(pm.response.text());",
|
|
"",
|
|
" pm.test('Response contains \"profile\" property', () => {",
|
|
" pm.expect(responseJSON).to.have.property('profile');",
|
|
" });",
|
|
" ",
|
|
" var profile = responseJSON.profile || {};",
|
|
"",
|
|
" pm.test('Profile has \"username\" property', () => {",
|
|
" pm.expect(profile).to.have.property('username');",
|
|
" });",
|
|
" pm.test('Profile has \"image\" property', () => {",
|
|
" pm.expect(profile).to.have.property('image');",
|
|
" });",
|
|
" pm.test('Profile has \"following\" property', () => {",
|
|
" pm.expect(profile).to.have.property('following');",
|
|
" });",
|
|
" pm.test('Profile\\'s \"following\" property is false', () => {",
|
|
" pm.expect(profile.following).to.eql(false);",
|
|
" });",
|
|
" }",
|
|
"}",
|
|
""
|
|
],
|
|
"type": "text/javascript",
|
|
"packages": {}
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "DELETE",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "X-Requested-With",
|
|
"value": "XMLHttpRequest"
|
|
},
|
|
{
|
|
"key": "Authorization",
|
|
"value": "Token {{token}}"
|
|
}
|
|
],
|
|
"url": {
|
|
"raw": "{{apiUrl}}/profiles/annehonime/follow",
|
|
"host": [
|
|
"{{apiUrl}}"
|
|
],
|
|
"path": [
|
|
"profiles",
|
|
"annehonime",
|
|
"follow"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "Tags",
|
|
"item": [
|
|
{
|
|
"name": "Create Tag",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Response code is 201 Created\", () => {",
|
|
" pm.expect(pm.response.code).to.eql(201);",
|
|
"});",
|
|
"",
|
|
"if(pm.response.code === 201){",
|
|
" var responseJSON = JSON.parse(pm.response.text());",
|
|
"",
|
|
" pm.test('Response contains \"article\" property', () => {",
|
|
" pm.expect(responseJSON).to.have.property('article');",
|
|
" });",
|
|
"",
|
|
" var article = responseJSON.article || {};",
|
|
"",
|
|
" pm.test('Article has \"title\" property', () => {",
|
|
" pm.expect(article).to.have.property('title');",
|
|
" });",
|
|
" pm.test('Article has \"slug\" property', () => {",
|
|
" try {",
|
|
" pm.expect(article).to.have.property('slug');",
|
|
" } catch (e) {",
|
|
" throw (e);",
|
|
" }",
|
|
" pm.collectionVariables.set('slug', article.slug);",
|
|
" });",
|
|
" pm.test('Article has \"body\" property', () => {",
|
|
" pm.expect(article).to.have.property('body');",
|
|
" });",
|
|
" pm.test('Article has \"description\" property', () => {",
|
|
" pm.expect(article).to.have.property('description');",
|
|
" });",
|
|
" pm.test('Article has \"tagList\" property', () => {",
|
|
" pm.expect(article).to.have.property('tagList');",
|
|
" });",
|
|
" pm.test('Article\\'s \"tagList\" property is an Array', () => {",
|
|
" pm.expect(article.tagList).to.be.an(\"array\");",
|
|
" });",
|
|
" pm.test('Article has \"favorited\" property', () => {",
|
|
" pm.expect(article).to.have.property('favorited');",
|
|
" });",
|
|
" pm.test('Article has \"favoritesCount\" property', () => {",
|
|
" pm.expect(article).to.have.property('favoritesCount');",
|
|
" });",
|
|
" pm.test('Article\\'s \"favoritesCount\" property is an integer', () => {",
|
|
" pm.expect(article.favoritesCount).to.be.a(\"number\");",
|
|
" });",
|
|
" pm.test('Article has an ISO 8601 timestamp \"createdAt\" property', () => {",
|
|
" pm.expect(article).to.have.property('createdAt');",
|
|
" pm.expect(article.createdAt).to.eql(new Date(article.createdAt).toISOString());",
|
|
" });",
|
|
" pm.test('Article has an ISO 8601 timestamp \"updatedAt\" property', () => {",
|
|
" pm.expect(article).to.have.property('updatedAt');",
|
|
" pm.expect(article.updatedAt).to.eql(new Date(article.updatedAt).toISOString());",
|
|
" });",
|
|
" pm.test('Article has \"author\" property', () => {",
|
|
" pm.expect(article).to.have.property('author');",
|
|
" });",
|
|
" pm.test('Article\\'s \"author\" property has not credential properties', () => {",
|
|
" pm.expect(article.author).not.to.have.property('salt');",
|
|
" pm.expect(article.author).not.to.have.property('hash');",
|
|
" });",
|
|
"}",
|
|
""
|
|
],
|
|
"type": "text/javascript",
|
|
"packages": {}
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "X-Requested-With",
|
|
"value": "XMLHttpRequest"
|
|
},
|
|
{
|
|
"key": "Authorization",
|
|
"value": "Token {{token}}"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"article\": {\n \"title\": \"How to tame an octopus\",\n \"description\": \"Ever wonder how?\",\n \"body\": \"Very carefully.\",\n \"tagList\": [\n \"octopus\",\n \"training\"\n ]\n }\n}"
|
|
},
|
|
"url": {
|
|
"raw": "{{apiUrl}}/articles",
|
|
"host": [
|
|
"{{apiUrl}}"
|
|
],
|
|
"path": [
|
|
"articles"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
},
|
|
{
|
|
"name": "All Tags",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"pm.test(\"Response code is 200 OK\", () => {",
|
|
" pm.expect(pm.response.code).to.eql(200);",
|
|
"});",
|
|
"",
|
|
"if(pm.response.code === 200){",
|
|
" var responseJSON = JSON.parse(pm.response.text());",
|
|
"",
|
|
" pm.test('Response contains \"tags\" property', () => {",
|
|
" pm.expect(responseJSON).to.have.property('tags');",
|
|
" });",
|
|
" pm.test('\"tags\" property is an Array', () => {",
|
|
" pm.expect(responseJSON.tags).to.be.an(\"array\");",
|
|
" });",
|
|
"}"
|
|
],
|
|
"type": "text/javascript",
|
|
"packages": {}
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "GET",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "X-Requested-With",
|
|
"value": "XMLHttpRequest"
|
|
}
|
|
],
|
|
"url": {
|
|
"raw": "{{apiUrl}}/tags",
|
|
"host": [
|
|
"{{apiUrl}}"
|
|
],
|
|
"path": [
|
|
"tags"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "Cleanup",
|
|
"item": [
|
|
{
|
|
"name": "Delete Article",
|
|
"request": {
|
|
"method": "DELETE",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
},
|
|
{
|
|
"key": "X-Requested-With",
|
|
"value": "XMLHttpRequest"
|
|
},
|
|
{
|
|
"key": "Authorization",
|
|
"value": "Token {{token}}"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": ""
|
|
},
|
|
"url": {
|
|
"raw": "{{apiUrl}}/articles/{{slug}}",
|
|
"host": [
|
|
"{{apiUrl}}"
|
|
],
|
|
"path": [
|
|
"articles",
|
|
"{{slug}}"
|
|
]
|
|
}
|
|
},
|
|
"response": []
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"variable": [
|
|
{
|
|
"key": "token",
|
|
"value": ""
|
|
},
|
|
{
|
|
"key": "clanId",
|
|
"value": ""
|
|
},
|
|
{
|
|
"key": "memberId",
|
|
"value": ""
|
|
},
|
|
{
|
|
"key": "slug",
|
|
"value": ""
|
|
}
|
|
]
|
|
} |