Skip to content

Commit 934db21

Browse files
committed
Added routes to test edit profile
1 parent 8066524 commit 934db21

File tree

1 file changed

+188
-13
lines changed

1 file changed

+188
-13
lines changed

PyMatcha.postman_collection.json

Lines changed: 188 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,7 +1180,7 @@
11801180
"",
11811181
"tests[\"Is email correct\"] = response.email == user_email",
11821182
"tests[\"Is username correct\"] = response.username == user_username",
1183-
"tests[\"Are tags present\"] = response.tags.length == 7",
1183+
"tests[\"Are tags present\"] = response.tags.length == 0",
11841184
"",
11851185
"pm.collectionVariables.set(\"user_id\", response.id)"
11861186
],
@@ -1319,7 +1319,7 @@
13191319
"header": [],
13201320
"body": {
13211321
"mode": "raw",
1322-
"raw": "{\n\t\"orientation\": \"heterosexual\",\n\t\"bio\": \"Nunc faucibus velit metus, nec iaculis sem fringilla ut. Nullam vel vulputate diam. Vivamus vehicula, enim at hendrerit tincidunt, leo sapien maximus nisi, nec suscipit arcu nisi a turpis. Suspendisse rutrum quis quam et sollicitudin. Proin commodo justo non dui tempor, at maximus velit vulputate. Integer vitae porta nulla, ut congue est. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin purus ex, venenatis vel aliquet a, interdum sit amet quam. Donec ac volutpat dui. In ornare augue in nisi efficitur varius. Donec hendrerit nunc a pulvinar posuere. Donec malesuada eros quam, eget pharetra nunc elementum in.\",\n\t\"tags\": [\n\t\t\"bot\",\n\t\t\"robot\",\n\t\t\"postman\",\n\t\t\"sex\",\n\t\t\"friends\",\n\t\t\"drink\",\n\t\t\"smoke\"\n\t\t],\n\t\"gender\": \"other\",\n\t\"birthdate\": 1590674628\n}",
1322+
"raw": "{\n\t\"orientation\": \"{{user_orientation}}\",\n\t\"bio\": \"{{user_bio}}\",\n\t\"tags\": [\n\t\t\"bot\",\n\t\t\"robot\",\n\t\t\"postman\",\n\t\t\"sex\",\n\t\t\"friends\",\n\t\t\"drink\",\n\t\t\"smoke\"\n\t\t],\n\t\"gender\": \"{{user_gender}}\",\n\t\"birthdate\": {{user_birthdate}}\n}",
13231323
"options": {
13241324
"raw": {
13251325
"language": "json"
@@ -1391,6 +1391,157 @@
13911391
}
13921392
},
13931393
"response": []
1394+
},
1395+
{
1396+
"name": "Get one user after completed profile",
1397+
"event": [
1398+
{
1399+
"listen": "test",
1400+
"script": {
1401+
"id": "2383f4d3-633d-40e9-a730-e39d9d24f1e5",
1402+
"exec": [
1403+
"var response = JSON.parse(responseBody);",
1404+
"",
1405+
"",
1406+
"pm.test(\"Status code is 200\", function () {",
1407+
" pm.response.to.have.status(200);",
1408+
"});",
1409+
"",
1410+
"user_email = pm.collectionVariables.get(\"user_email\");",
1411+
"user_username = pm.collectionVariables.get(\"user_username\");",
1412+
"user_orientation = pm.collectionVariables.get(\"user_orientation\");",
1413+
"user_gender = pm.collectionVariables.get(\"user_gender\");",
1414+
"",
1415+
"tests[\"Is email correct\"] = response.email == user_email",
1416+
"tests[\"Is username correct\"] = response.username == user_username",
1417+
"tests[\"Are tags present\"] = response.tags.length == 7",
1418+
"tests[\"User orientation is correct\"] = response.orientation == user_orientation",
1419+
"tests[\"User gender is correct\"] = response.gender == user_gender",
1420+
"pm.collectionVariables.set(\"user_id\", response.id)"
1421+
],
1422+
"type": "text/javascript"
1423+
}
1424+
}
1425+
],
1426+
"request": {
1427+
"method": "GET",
1428+
"header": [],
1429+
"url": {
1430+
"raw": "{{host}}/users/{{user_username}}",
1431+
"host": [
1432+
"{{host}}"
1433+
],
1434+
"path": [
1435+
"users",
1436+
"{{user_username}}"
1437+
]
1438+
}
1439+
},
1440+
"response": []
1441+
},
1442+
{
1443+
"name": "Edit profile",
1444+
"event": [
1445+
{
1446+
"listen": "prerequest",
1447+
"script": {
1448+
"id": "8ff8a3b1-9b9c-4cb7-a9dd-c29eee539368",
1449+
"exec": [
1450+
""
1451+
],
1452+
"type": "text/javascript"
1453+
}
1454+
},
1455+
{
1456+
"listen": "test",
1457+
"script": {
1458+
"id": "f6ddbcb3-6fd6-4ef6-85a8-d176cd5f75b2",
1459+
"exec": [
1460+
"var response = JSON.parse(responseBody);",
1461+
"",
1462+
"",
1463+
"pm.test(\"Status code is 200\", function () {",
1464+
" pm.response.to.have.status(200);",
1465+
"});",
1466+
"",
1467+
"",
1468+
"tests[\"success is true\"] = response.success == true",
1469+
"tests[\"Message is correct\"] = response.message == \"User successfully modified !\"",
1470+
""
1471+
],
1472+
"type": "text/javascript"
1473+
}
1474+
}
1475+
],
1476+
"request": {
1477+
"method": "PUT",
1478+
"header": [],
1479+
"body": {
1480+
"mode": "raw",
1481+
"raw": "{\n\t\"orientation\": \"heterosexual\",\n\t\"bio\": \"{{user_bio}}\",\n\t\"tags\": [\n\t\t\"bot\",\n\t\t\"robot\",\n\t\t\"postman\",\n\t\t\"sex\",\n\t\t\"friends\",\n\t\t\"drink\",\n\t\t\"smoke\"\n\t\t],\n\t\"gender\": \"male\",\n\t\"birthdate\": {{user_birthdate}},\n\t\"first_name\": \"Foo\",\n\t\"last_name\": \"Bar\",\n\t\"username\": \"FooBar\"\n}",
1482+
"options": {
1483+
"raw": {
1484+
"language": "json"
1485+
}
1486+
}
1487+
},
1488+
"url": {
1489+
"raw": "{{host}}/profile/edit",
1490+
"host": [
1491+
"{{host}}"
1492+
],
1493+
"path": [
1494+
"profile",
1495+
"edit"
1496+
]
1497+
}
1498+
},
1499+
"response": []
1500+
},
1501+
{
1502+
"name": "Get one user after edited profile",
1503+
"event": [
1504+
{
1505+
"listen": "test",
1506+
"script": {
1507+
"id": "5f13dea7-7c67-41ec-97ca-14ed10444b09",
1508+
"exec": [
1509+
"var response = JSON.parse(responseBody);",
1510+
"",
1511+
"",
1512+
"pm.test(\"Status code is 200\", function () {",
1513+
" pm.response.to.have.status(200);",
1514+
"});",
1515+
"",
1516+
"user_email = pm.collectionVariables.get(\"user_email\");",
1517+
"user_orientation = pm.collectionVariables.get(\"user_orientation\");",
1518+
"",
1519+
"tests[\"Is email correct\"] = response.email == user_email",
1520+
"tests[\"Is username correct\"] = response.username == \"FooBar\"",
1521+
"tests[\"Are tags present\"] = response.tags.length == 7",
1522+
"tests[\"User orientation is correct\"] = response.orientation == user_orientation",
1523+
"tests[\"User gender is correct\"] = response.gender == \"male\"",
1524+
"pm.collectionVariables.set(\"user_id\", response.id)"
1525+
],
1526+
"type": "text/javascript"
1527+
}
1528+
}
1529+
],
1530+
"request": {
1531+
"method": "GET",
1532+
"header": [],
1533+
"url": {
1534+
"raw": "{{host}}/users/{{user_email}}",
1535+
"host": [
1536+
"{{host}}"
1537+
],
1538+
"path": [
1539+
"users",
1540+
"{{user_email}}"
1541+
]
1542+
}
1543+
},
1544+
"response": []
13941545
}
13951546
],
13961547
"protocolProfileBehavior": {}
@@ -1495,70 +1646,94 @@
14951646
],
14961647
"variable": [
14971648
{
1498-
"id": "c93127c5-53b6-418a-8dde-326f3060929a",
1649+
"id": "ee3529e9-cdd6-4308-8a1d-0edef6fca8e1",
14991650
"key": "host",
15001651
"value": "http://127.0.0.1:5000",
15011652
"type": "string"
15021653
},
15031654
{
1504-
"id": "c0f8da9e-693a-49a2-b9b4-547b81a931dd",
1655+
"id": "a5f28010-fcaa-45b8-854a-818903317da6",
15051656
"key": "user_id",
15061657
"value": "",
15071658
"type": "string"
15081659
},
15091660
{
1510-
"id": "e812d2b5-9edf-4929-9bca-64385a2f8fee",
1661+
"id": "e5433b0f-60e3-4167-9312-bf9ec4962983",
15111662
"key": "user_email",
15121663
"value": "foo@example.org",
15131664
"type": "string"
15141665
},
15151666
{
1516-
"id": "2b497dba-272c-458e-a66b-bc2470f7f0cc",
1667+
"id": "7a18a68c-3244-4dd6-9a7d-3c309bb176f5",
15171668
"key": "user_username",
15181669
"value": "bar",
15191670
"type": "string"
15201671
},
15211672
{
1522-
"id": "f0e4819d-a3ee-4f0a-a175-801c3eb06e70",
1673+
"id": "0cedfada-9756-439c-9c47-5f26be9b4cb3",
15231674
"key": "user_password",
15241675
"value": "admin",
15251676
"type": "string"
15261677
},
15271678
{
1528-
"id": "1bc72851-3589-4f59-9ca2-cbb22ae044b9",
1679+
"id": "99d5eccf-e07f-40e5-8d6d-fd43c448eb9f",
15291680
"key": "user_firstname",
15301681
"value": "Foo",
15311682
"type": "string"
15321683
},
15331684
{
1534-
"id": "56678e7a-8172-4342-b939-076286a713da",
1685+
"id": "2c8e556b-46ba-4a99-b47e-a8d320a6f682",
15351686
"key": "user_lastname",
15361687
"value": "Bar",
15371688
"type": "string"
15381689
},
15391690
{
1540-
"id": "3fab058a-563a-4ce8-a967-4c3f54bc8d10",
1691+
"id": "32314549-41a0-4aa7-ae5b-3568c4aa9cc0",
15411692
"key": "debug_token",
15421693
"value": "xX69jules69Xx",
15431694
"type": "string"
15441695
},
15451696
{
1546-
"id": "40f0d53a-930b-4b6d-8748-7b05d6154c2c",
1697+
"id": "44809d49-7682-44e4-90a2-e17de7a8a95e",
15471698
"key": "user_access_token",
15481699
"value": "",
15491700
"type": "string"
15501701
},
15511702
{
1552-
"id": "c9617f1e-454a-457c-af53-2b37e5d0fdb4",
1703+
"id": "8b42b046-2f60-4e87-a49d-d79206d3001f",
15531704
"key": "user_refresh_token",
15541705
"value": "",
15551706
"type": "string"
15561707
},
15571708
{
1558-
"id": "f65ff0a6-1581-408a-af30-5d02554d0af5",
1709+
"id": "591d0ce5-469b-4b46-9600-ddf097e7fd50",
15591710
"key": "expired_token",
15601711
"value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1OTAyNDIyNjQsIm5iZiI6MTU5MDI0MjI2NCwianRpIjoiNTM0ZGI5NzQtOWE4Ni00MGViLWE1NDEtMDg3N2ZmNzQ3NDVhIiwiZXhwIjoxNTkwMjQyMzI0LCJpZGVudGl0eSI6eyJpZCI6NTEyLCJlbWFpbCI6ImZvb0BleGFtcGxlLm9yZyIsInVzZXJuYW1lIjoiYmFyIiwiaXNfb25saW5lIjp0cnVlLCJkYXRlX2xhc3RzZWVuIjoiU2F0LCAyMyBNYXkgMjAyMCAxMzo1Nzo0NCBHTVQifSwiZnJlc2giOnRydWUsInR5cGUiOiJhY2Nlc3MifQ.NTp2P0WNkXDwzuzrcNIQdeAfizQ57HQgkzBLSvY1yHU",
15611712
"type": "string"
1713+
},
1714+
{
1715+
"id": "b0b34788-e107-4efe-ad31-a873640c2f31",
1716+
"key": "user_orientation",
1717+
"value": "heterosexual",
1718+
"type": "string"
1719+
},
1720+
{
1721+
"id": "1e8dcc93-4687-4f75-9ebc-7db3bac516b8",
1722+
"key": "user_bio",
1723+
"value": "Lorem Ipsum is the single greatest threat. We are not - we are not keeping up with other websites. Lorem Ipsum best not make any more threats to your website. It will be met with fire and fury like the world has never seen. Does everybody know that pig named Lorem Ipsum? An ‘extremely credible source’ has called my office and told me that Barack Obama’s placeholder text is a fraud.",
1724+
"type": "string"
1725+
},
1726+
{
1727+
"id": "9465dc19-d5ad-4392-ab87-6ae12e29a907",
1728+
"key": "user_gender",
1729+
"value": "other",
1730+
"type": "string"
1731+
},
1732+
{
1733+
"id": "e1770e73-72f5-4e3d-92d8-4b2584b68ba3",
1734+
"key": "user_birthdate",
1735+
"value": "1590674628",
1736+
"type": "string"
15621737
}
15631738
],
15641739
"protocolProfileBehavior": {}

0 commit comments

Comments
 (0)