Update protected files
This commit is contained in:
committed by
GitHub
parent
ed687650ba
commit
3c335f9efe
+331
-120
@@ -118,7 +118,7 @@
|
||||
" var url = pm.variables.get(\"base_url\") + `/countries?region=${country.region}`;",
|
||||
"",
|
||||
" pm.sendRequest(url, function (err, response) {",
|
||||
" pm.test(\"Validate response\", () => {",
|
||||
" pm.test(`Validate response for region ${country.region}`, () => {",
|
||||
" var resp = response.json();",
|
||||
" ",
|
||||
" pm.expect(response.code).to.be.eq(200, \"Invalid response code status\");",
|
||||
@@ -383,16 +383,15 @@
|
||||
}
|
||||
],
|
||||
"request": {
|
||||
"method": "POST",
|
||||
"method": "GET",
|
||||
"header": [],
|
||||
"url": {
|
||||
"raw": "{{base_url}}/auth/register",
|
||||
"raw": "{{base_url}}/ping",
|
||||
"host": [
|
||||
"{{base_url}}"
|
||||
],
|
||||
"path": [
|
||||
"auth",
|
||||
"register"
|
||||
"ping"
|
||||
]
|
||||
}
|
||||
},
|
||||
@@ -403,6 +402,133 @@
|
||||
{
|
||||
"name": "04/auth/sign-in",
|
||||
"item": [
|
||||
{
|
||||
"name": "Register a user",
|
||||
"event": [
|
||||
{
|
||||
"listen": "test",
|
||||
"script": {
|
||||
"exec": [
|
||||
"var schema = {",
|
||||
" \"type\": \"object\",",
|
||||
" \"properties\": {",
|
||||
" \"profile\": {",
|
||||
" \"type\": \"object\",",
|
||||
" \"description\": \"Информация о профиле пользователя\",",
|
||||
" \"properties\": {",
|
||||
" \"login\": {",
|
||||
" \"type\": \"string\",",
|
||||
" \"description\": \"Логин пользователя\",",
|
||||
" \"maxLength\": 30,",
|
||||
" \"pattern\": \"[a-zA-Z0-9-]+\"",
|
||||
" },",
|
||||
" \"email\": {",
|
||||
" \"type\": \"string\",",
|
||||
" \"description\": \"E-mail пользователя\",",
|
||||
" \"maxLength\": 50",
|
||||
" },",
|
||||
" \"countryCode\": {",
|
||||
" \"type\": \"string\",",
|
||||
" \"description\": \"Двухбуквенный код, уникально идентифицирующий страну\",",
|
||||
" \"maxLength\": 2,",
|
||||
" \"pattern\": \"[a-zA-Z]{2}\"",
|
||||
" },",
|
||||
" \"isPublic\": {",
|
||||
" \"type\": \"boolean\",",
|
||||
" \"description\": \"Является ли данный профиль публичным. \\n\\nПубличные профили доступны другим пользователям: если профиль публичный, любой пользователь платформы сможет получить информацию о пользователе.\\n\"",
|
||||
" },",
|
||||
" \"phone\": {",
|
||||
" \"type\": \"string\",",
|
||||
" \"description\": \"Номер телефона пользователя в формате +123456789\",",
|
||||
" \"pattern\": \"\\\\+[\\\\d]+\"",
|
||||
" },",
|
||||
" \"image\": {",
|
||||
" \"type\": \"string\",",
|
||||
" \"description\": \"Ссылка на фото для аватара пользователя\",",
|
||||
" \"maxLength\": 200",
|
||||
" }",
|
||||
" },",
|
||||
" \"required\": [",
|
||||
" \"login\",",
|
||||
" \"email\",",
|
||||
" \"countryCode\",",
|
||||
" \"isPublic\"",
|
||||
" ]",
|
||||
" }",
|
||||
" },",
|
||||
" \"required\": [",
|
||||
" \"profile\"",
|
||||
" ],",
|
||||
" \"$schema\": \"http://json-schema.org/draft-04/schema#\"",
|
||||
"};",
|
||||
"",
|
||||
"pm.test(\"Register a user\", function () {",
|
||||
" var url = pm.variables.get(\"base_url\") + \"/auth/register\";",
|
||||
" const options = {",
|
||||
" url: url,",
|
||||
" method: 'POST',",
|
||||
" header: {",
|
||||
" 'Content-Type': 'application/json',",
|
||||
" },",
|
||||
" body: {",
|
||||
" mode: 'raw',",
|
||||
" raw: JSON.stringify({",
|
||||
" 'login': 'yellowMonkey2',",
|
||||
" 'email': 'yellowstone1980@you.ru',",
|
||||
" 'password': '$aba4821FWfew01#.fewA$',",
|
||||
" 'countryCode': 'RU',",
|
||||
" 'isPublic': true,",
|
||||
" 'phone': '+74951239922',",
|
||||
" })",
|
||||
" }",
|
||||
" };",
|
||||
"",
|
||||
" const profile = {",
|
||||
" 'profile': {",
|
||||
" 'login': 'yellowMonkey2',",
|
||||
" 'email': 'yellowstone1980@you.ru',",
|
||||
" 'countryCode': 'RU',",
|
||||
" 'isPublic': true,",
|
||||
" 'phone': '+74951239922',",
|
||||
" }",
|
||||
" }",
|
||||
"",
|
||||
" pm.sendRequest(options, function (err, response) {",
|
||||
" pm.test(\"Validate response\", () => {",
|
||||
" var resp = response.json();",
|
||||
" ",
|
||||
" pm.expect(response.code).to.be.oneOf([201, 409], \"Invalid response code status\");",
|
||||
" pm.expect(tv4.validate(resp, schema), \"Invalid JSON schema\").to.be.true;",
|
||||
"",
|
||||
" console.log(\"got\", resp, \"expected\", profile);",
|
||||
" pm.expect(resp).to.deep.eq(profile, `Got invalid object`);",
|
||||
" });",
|
||||
" });",
|
||||
"});",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
""
|
||||
],
|
||||
"type": "text/javascript"
|
||||
}
|
||||
}
|
||||
],
|
||||
"request": {
|
||||
"method": "GET",
|
||||
"header": [],
|
||||
"url": {
|
||||
"raw": "{{base_url}}/ping",
|
||||
"host": [
|
||||
"{{base_url}}"
|
||||
],
|
||||
"path": [
|
||||
"ping"
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "Sign in",
|
||||
"event": [
|
||||
@@ -425,6 +551,122 @@
|
||||
" \"$schema\": \"http://json-schema.org/draft-04/schema#\"",
|
||||
"};",
|
||||
"",
|
||||
"pm.test(\"Sign in\", function () {",
|
||||
" var url = pm.variables.get(\"base_url\") + \"/auth/sign-in\";",
|
||||
" const options = {",
|
||||
" url: url,",
|
||||
" method: 'POST',",
|
||||
" header: {",
|
||||
" 'Content-Type': 'application/json',",
|
||||
" },",
|
||||
" body: {",
|
||||
" mode: 'raw',",
|
||||
" raw: JSON.stringify({",
|
||||
" 'login': 'yellowMonkey2',",
|
||||
" 'password': '$aba4821FWfew01#.fewA$',",
|
||||
" })",
|
||||
" }",
|
||||
" };",
|
||||
"",
|
||||
" pm.sendRequest(options, function (err, response) {",
|
||||
" pm.test(\"Validate sign-in response\", () => {",
|
||||
" var resp = response.json();",
|
||||
"",
|
||||
" pm.expect(response.code).to.be.eq(200, \"Invalid response code status\");",
|
||||
" pm.expect(tv4.validate(resp, schema), \"Invalid JSON schema\").to.be.true;",
|
||||
"",
|
||||
" console.log('Token', resp.token);",
|
||||
" });",
|
||||
" });",
|
||||
"});",
|
||||
"",
|
||||
"",
|
||||
""
|
||||
],
|
||||
"type": "text/javascript"
|
||||
}
|
||||
}
|
||||
],
|
||||
"request": {
|
||||
"method": "GET",
|
||||
"header": [],
|
||||
"url": {
|
||||
"raw": "{{base_url}}/ping",
|
||||
"host": [
|
||||
"{{base_url}}"
|
||||
],
|
||||
"path": [
|
||||
"ping"
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "05/me",
|
||||
"item": [
|
||||
{
|
||||
"name": "Register a user",
|
||||
"event": [
|
||||
{
|
||||
"listen": "test",
|
||||
"script": {
|
||||
"exec": [
|
||||
"var schema = {",
|
||||
" \"type\": \"object\",",
|
||||
" \"properties\": {",
|
||||
" \"profile\": {",
|
||||
" \"type\": \"object\",",
|
||||
" \"description\": \"Информация о профиле пользователя\",",
|
||||
" \"properties\": {",
|
||||
" \"login\": {",
|
||||
" \"type\": \"string\",",
|
||||
" \"description\": \"Логин пользователя\",",
|
||||
" \"maxLength\": 30,",
|
||||
" \"pattern\": \"[a-zA-Z0-9-]+\"",
|
||||
" },",
|
||||
" \"email\": {",
|
||||
" \"type\": \"string\",",
|
||||
" \"description\": \"E-mail пользователя\",",
|
||||
" \"maxLength\": 50",
|
||||
" },",
|
||||
" \"countryCode\": {",
|
||||
" \"type\": \"string\",",
|
||||
" \"description\": \"Двухбуквенный код, уникально идентифицирующий страну\",",
|
||||
" \"maxLength\": 2,",
|
||||
" \"pattern\": \"[a-zA-Z]{2}\"",
|
||||
" },",
|
||||
" \"isPublic\": {",
|
||||
" \"type\": \"boolean\",",
|
||||
" \"description\": \"Является ли данный профиль публичным. \\n\\nПубличные профили доступны другим пользователям: если профиль публичный, любой пользователь платформы сможет получить информацию о пользователе.\\n\"",
|
||||
" },",
|
||||
" \"phone\": {",
|
||||
" \"type\": \"string\",",
|
||||
" \"description\": \"Номер телефона пользователя в формате +123456789\",",
|
||||
" \"pattern\": \"\\\\+[\\\\d]+\"",
|
||||
" },",
|
||||
" \"image\": {",
|
||||
" \"type\": \"string\",",
|
||||
" \"description\": \"Ссылка на фото для аватара пользователя\",",
|
||||
" \"maxLength\": 200",
|
||||
" }",
|
||||
" },",
|
||||
" \"required\": [",
|
||||
" \"login\",",
|
||||
" \"email\",",
|
||||
" \"countryCode\",",
|
||||
" \"isPublic\"",
|
||||
" ]",
|
||||
" }",
|
||||
" },",
|
||||
" \"required\": [",
|
||||
" \"profile\"",
|
||||
" ],",
|
||||
" \"$schema\": \"http://json-schema.org/draft-04/schema#\"",
|
||||
"};",
|
||||
"",
|
||||
"pm.test(\"Register a user\", function () {",
|
||||
" var url = pm.variables.get(\"base_url\") + \"/auth/register\";",
|
||||
" const options = {",
|
||||
@@ -436,50 +678,32 @@
|
||||
" body: {",
|
||||
" mode: 'raw',",
|
||||
" raw: JSON.stringify({",
|
||||
" 'login': 'yellowMonkey11000',",
|
||||
" 'email': 'yellowstone1983@you.ru',",
|
||||
" 'login': 'yellowMonkey10000',",
|
||||
" 'email': 'yellowstone1980@you.ru',",
|
||||
" 'password': '$aba4821FWfew01#.fewA$',",
|
||||
" 'countryCode': 'RU',",
|
||||
" 'isPublic': true,",
|
||||
" 'phone': '+74951239912',",
|
||||
" 'phone': '+74951239922',",
|
||||
" })",
|
||||
" }",
|
||||
" };",
|
||||
"",
|
||||
" const profile = {",
|
||||
" 'profile': {",
|
||||
" 'login': 'yellowMonkey10000',",
|
||||
" 'email': 'yellowstone1980@you.ru',",
|
||||
" 'countryCode': 'RU',",
|
||||
" 'isPublic': true,",
|
||||
" 'phone': '+74951239922',",
|
||||
" }",
|
||||
" }",
|
||||
"",
|
||||
" pm.sendRequest(options, function (err, response) {",
|
||||
" pm.test(\"Validate register response\", () => {",
|
||||
" pm.test(\"Validate response\", () => {",
|
||||
" var resp = response.json();",
|
||||
" ",
|
||||
" pm.expect(response.code).to.be.oneOf([201, 409], \"Invalid response code status\");",
|
||||
" });",
|
||||
"",
|
||||
" pm.test(\"Sign in\", function () {",
|
||||
" var url = pm.variables.get(\"base_url\") + \"/auth/sign-in\";",
|
||||
" const options = {",
|
||||
" url: url,",
|
||||
" method: 'POST',",
|
||||
" header: {",
|
||||
" 'Content-Type': 'application/json',",
|
||||
" },",
|
||||
" body: {",
|
||||
" mode: 'raw',",
|
||||
" raw: JSON.stringify({",
|
||||
" 'login': 'yellowMonkey11000',",
|
||||
" 'password': '$aba4821FWfew01#.fewA$',",
|
||||
" })",
|
||||
" }",
|
||||
" };",
|
||||
"",
|
||||
" pm.sendRequest(options, function (err, response) {",
|
||||
" pm.test(\"Validate sign-in response\", () => {",
|
||||
" var resp = response.json();",
|
||||
"",
|
||||
" pm.expect(response.code).to.be.eq(200, \"Invalid response code status\");",
|
||||
" pm.expect(tv4.validate(resp, schema), \"Invalid JSON schema\").to.be.true;",
|
||||
"",
|
||||
" console.log('Token', resp.token);",
|
||||
" });",
|
||||
" });",
|
||||
" });",
|
||||
" });",
|
||||
"});",
|
||||
"",
|
||||
@@ -492,28 +716,22 @@
|
||||
}
|
||||
],
|
||||
"request": {
|
||||
"method": "POST",
|
||||
"method": "GET",
|
||||
"header": [],
|
||||
"url": {
|
||||
"raw": "{{base_url}}/auth/sign-in",
|
||||
"raw": "{{base_url}}/ping",
|
||||
"host": [
|
||||
"{{base_url}}"
|
||||
],
|
||||
"path": [
|
||||
"auth",
|
||||
"sign-in"
|
||||
"ping"
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "05/me",
|
||||
"item": [
|
||||
},
|
||||
{
|
||||
"name": "Get my profile",
|
||||
"name": "Sign in",
|
||||
"event": [
|
||||
{
|
||||
"listen": "test",
|
||||
@@ -534,9 +752,9 @@
|
||||
" \"$schema\": \"http://json-schema.org/draft-04/schema#\"",
|
||||
"};",
|
||||
"",
|
||||
"pm.test(\"Register a user\", function () {",
|
||||
" var url = pm.variables.get(\"base_url\") + \"/auth/register\";",
|
||||
" const options = {",
|
||||
"pm.test(\"Sign in\", function () {",
|
||||
" var url = pm.variables.get(\"base_url\") + \"/auth/sign-in\";",
|
||||
" var options = {",
|
||||
" url: url,",
|
||||
" method: 'POST',",
|
||||
" header: {",
|
||||
@@ -545,84 +763,26 @@
|
||||
" body: {",
|
||||
" mode: 'raw',",
|
||||
" raw: JSON.stringify({",
|
||||
" 'login': 'yellowMonkey11000',",
|
||||
" 'email': 'yellowstone1983@you.ru',",
|
||||
" 'login': 'yellowMonkey10000',",
|
||||
" 'password': '$aba4821FWfew01#.fewA$',",
|
||||
" 'countryCode': 'RU',",
|
||||
" 'isPublic': true,",
|
||||
" 'phone': '+74951239912',",
|
||||
" })",
|
||||
" }",
|
||||
" };",
|
||||
"",
|
||||
" ",
|
||||
" pm.sendRequest(options, function (err, response) {",
|
||||
" pm.test(\"Validate register response\", () => {",
|
||||
" pm.test(\"Validate sign-in response\", () => {",
|
||||
" var resp = response.json();",
|
||||
" pm.expect(response.code).to.be.oneOf([201, 409], \"Invalid response code status\");",
|
||||
" });",
|
||||
"",
|
||||
" pm.test(\"Sign in\", function () {",
|
||||
" var url = pm.variables.get(\"base_url\") + \"/auth/sign-in\";",
|
||||
" const options = {",
|
||||
" url: url,",
|
||||
" method: 'POST',",
|
||||
" header: {",
|
||||
" 'Content-Type': 'application/json',",
|
||||
" },",
|
||||
" body: {",
|
||||
" mode: 'raw',",
|
||||
" raw: JSON.stringify({",
|
||||
" 'login': 'yellowMonkey11000',",
|
||||
" 'password': '$aba4821FWfew01#.fewA$',",
|
||||
" })",
|
||||
" }",
|
||||
" };",
|
||||
" pm.expect(response.code).to.be.eq(200, \"Invalid response code status\");",
|
||||
" pm.expect(tv4.validate(resp, schema), \"Invalid JSON schema\").to.be.true;",
|
||||
"",
|
||||
" pm.sendRequest(options, function (err, response) {",
|
||||
" pm.test(\"Validate sign-in response\", () => {",
|
||||
" var resp = response.json();",
|
||||
"",
|
||||
" pm.expect(response.code).to.be.eq(200, \"Invalid response code status\");",
|
||||
" pm.expect(tv4.validate(resp, schema), \"Invalid JSON schema\").to.be.true;",
|
||||
"",
|
||||
" pm.environment.set(\"05_profile_token\", resp.token);",
|
||||
" console.log(\"Token has been saved\")",
|
||||
"",
|
||||
" pm.test(\"Get profile\", function () {",
|
||||
" const url = pm.variables.get(\"base_url\") + \"/me/profile\";",
|
||||
" const token = pm.environment.get(\"05_profile_token\");",
|
||||
" const options = {",
|
||||
" url: url,",
|
||||
" method: 'GET',",
|
||||
" header: {",
|
||||
" 'Content-Type': 'application/json',",
|
||||
" 'Authorization': `Bearer ${token}`,",
|
||||
" },",
|
||||
" };",
|
||||
"",
|
||||
" pm.sendRequest(options, function (err, response) {",
|
||||
" pm.test(\"Validate profile\", () => {",
|
||||
" var resp = response.json();",
|
||||
"",
|
||||
" pm.expect(response.code).to.be.eq(200, \"Invalid response code status\");",
|
||||
"",
|
||||
" console.log(\"Got profile\", resp);",
|
||||
" pm.expect(resp.login).to.be.eq(\"yellowMonkey11000\", \"Invalid login\");",
|
||||
" });",
|
||||
" });",
|
||||
" });",
|
||||
" });",
|
||||
" });",
|
||||
" pm.environment.set(\"05_profile_token\", resp.token);",
|
||||
" console.log(\"Token has been saved\")",
|
||||
" });",
|
||||
" });",
|
||||
"});",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
""
|
||||
],
|
||||
"type": "text/javascript"
|
||||
@@ -633,13 +793,64 @@
|
||||
"method": "GET",
|
||||
"header": [],
|
||||
"url": {
|
||||
"raw": "{{base_url}}/me/profile",
|
||||
"raw": "{{base_url}}/ping",
|
||||
"host": [
|
||||
"{{base_url}}"
|
||||
],
|
||||
"path": [
|
||||
"me",
|
||||
"profile"
|
||||
"ping"
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "Get my profile",
|
||||
"event": [
|
||||
{
|
||||
"listen": "test",
|
||||
"script": {
|
||||
"exec": [
|
||||
"pm.test(\"Get profile\", function () {",
|
||||
" const url = pm.variables.get(\"base_url\") + \"/me/profile\";",
|
||||
" const token = pm.environment.get(\"05_profile_token\");",
|
||||
" const options = {",
|
||||
" url: url,",
|
||||
" method: 'GET',",
|
||||
" header: {",
|
||||
" 'Content-Type': 'application/json',",
|
||||
" 'Authorization': `Bearer ${token}`,",
|
||||
" },",
|
||||
" };",
|
||||
"",
|
||||
" pm.sendRequest(options, function (err, response) {",
|
||||
" pm.test(\"Validate profile\", () => {",
|
||||
" var resp = response.json();",
|
||||
"",
|
||||
" pm.expect(response.code).to.be.eq(200, \"Invalid response code status\");",
|
||||
"",
|
||||
" console.log(\"Got profile\", resp);",
|
||||
" pm.expect(resp.login).to.be.eq(\"yellowMonkey10000\", \"Invalid login\");",
|
||||
" });",
|
||||
" });",
|
||||
"});",
|
||||
"",
|
||||
""
|
||||
],
|
||||
"type": "text/javascript"
|
||||
}
|
||||
}
|
||||
],
|
||||
"request": {
|
||||
"method": "GET",
|
||||
"header": [],
|
||||
"url": {
|
||||
"raw": "{{base_url}}/ping",
|
||||
"host": [
|
||||
"{{base_url}}"
|
||||
],
|
||||
"path": [
|
||||
"ping"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user