feat: basic mocking setup
This commit is contained in:
parent
95fe298ae1
commit
82d909693d
2 changed files with 196 additions and 1 deletions
10
README.md
10
README.md
|
@ -1,3 +1,11 @@
|
||||||
# wolves-oxidised
|
# wolves-oxidised
|
||||||
|
|
||||||
Rust library to interact with the UL Wolves API
|
Rust library to interact with the UL Wolves API
|
||||||
|
|
||||||
|
## Mockoon
|
||||||
|
Mockoon is a tool that is able to mock an api.
|
||||||
|
The responses from Woles are mocked using this tool and are stored in ``mocking``.
|
||||||
|
|
||||||
|
``nix-shell -p mockoon``
|
||||||
|
|
||||||
|
Then load up teh config in ``mocking``
|
187
mocking/wolves_api.json
Normal file
187
mocking/wolves_api.json
Normal file
|
@ -0,0 +1,187 @@
|
||||||
|
{
|
||||||
|
"uuid": "5b065de8-1360-4d55-aba4-c0f919f3669e",
|
||||||
|
"lastMigration": 32,
|
||||||
|
"name": "Wolves API",
|
||||||
|
"endpointPrefix": "",
|
||||||
|
"latency": 0,
|
||||||
|
"port": 3001,
|
||||||
|
"hostname": "",
|
||||||
|
"folders": [],
|
||||||
|
"routes": [
|
||||||
|
{
|
||||||
|
"uuid": "b8a7a9df-6d18-46ca-9f55-87385b1654cd",
|
||||||
|
"type": "http",
|
||||||
|
"documentation": "",
|
||||||
|
"method": "post",
|
||||||
|
"endpoint": "get_cns",
|
||||||
|
"responses": [
|
||||||
|
{
|
||||||
|
"uuid": "55d1e82e-ea35-4929-b8ce-2b1fe6e2f962",
|
||||||
|
"body": "{\n \"success\": 1,\n \"result\": {{data 'WolvesCommittees'}}\n}",
|
||||||
|
"latency": 0,
|
||||||
|
"statusCode": 200,
|
||||||
|
"label": "",
|
||||||
|
"headers": [],
|
||||||
|
"bodyType": "INLINE",
|
||||||
|
"filePath": "",
|
||||||
|
"databucketID": "pwev",
|
||||||
|
"sendFileAsBody": false,
|
||||||
|
"rules": [],
|
||||||
|
"rulesOperator": "OR",
|
||||||
|
"disableTemplating": false,
|
||||||
|
"fallbackTo404": false,
|
||||||
|
"default": true,
|
||||||
|
"crudKey": "id",
|
||||||
|
"callbacks": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responseMode": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"uuid": "3d598a24-8088-43b4-a221-2296a7d7dc0b",
|
||||||
|
"type": "http",
|
||||||
|
"documentation": "",
|
||||||
|
"method": "post",
|
||||||
|
"endpoint": "get_members",
|
||||||
|
"responses": [
|
||||||
|
{
|
||||||
|
"uuid": "808c8312-66f6-4498-ac60-9fcf15211a6a",
|
||||||
|
"body": "{\n \"success\": 1,\n \"result\": {{data 'WolvesMembers'}}\n}",
|
||||||
|
"latency": 0,
|
||||||
|
"statusCode": 200,
|
||||||
|
"label": "",
|
||||||
|
"headers": [],
|
||||||
|
"bodyType": "INLINE",
|
||||||
|
"filePath": "",
|
||||||
|
"databucketID": "",
|
||||||
|
"sendFileAsBody": false,
|
||||||
|
"rules": [],
|
||||||
|
"rulesOperator": "OR",
|
||||||
|
"disableTemplating": false,
|
||||||
|
"fallbackTo404": false,
|
||||||
|
"default": true,
|
||||||
|
"crudKey": "id",
|
||||||
|
"callbacks": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responseMode": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"uuid": "18a929f9-e616-4cf6-a67e-0950e1248ce8",
|
||||||
|
"type": "http",
|
||||||
|
"documentation": "",
|
||||||
|
"method": "post",
|
||||||
|
"endpoint": "get_member",
|
||||||
|
"responses": [
|
||||||
|
{
|
||||||
|
"uuid": "f4b77b66-4e4b-4429-b5ca-7bd3cd06cd04",
|
||||||
|
"body": "{\n \"success\": 1,\n \"result\": {{data 'WolvesMember'}}\n}",
|
||||||
|
"latency": 0,
|
||||||
|
"statusCode": 200,
|
||||||
|
"label": "",
|
||||||
|
"headers": [],
|
||||||
|
"bodyType": "INLINE",
|
||||||
|
"filePath": "",
|
||||||
|
"databucketID": "",
|
||||||
|
"sendFileAsBody": false,
|
||||||
|
"rules": [],
|
||||||
|
"rulesOperator": "OR",
|
||||||
|
"disableTemplating": false,
|
||||||
|
"fallbackTo404": false,
|
||||||
|
"default": true,
|
||||||
|
"crudKey": "id",
|
||||||
|
"callbacks": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"uuid": "84af1b80-9b7c-48e9-a555-ed22f4652e75",
|
||||||
|
"body": "{\n \"success\": 1,\n \"result\": null\n}",
|
||||||
|
"latency": 0,
|
||||||
|
"statusCode": 200,
|
||||||
|
"label": "",
|
||||||
|
"headers": [],
|
||||||
|
"bodyType": "INLINE",
|
||||||
|
"filePath": "",
|
||||||
|
"databucketID": "",
|
||||||
|
"sendFileAsBody": false,
|
||||||
|
"rules": [],
|
||||||
|
"rulesOperator": "OR",
|
||||||
|
"disableTemplating": false,
|
||||||
|
"fallbackTo404": false,
|
||||||
|
"default": false,
|
||||||
|
"crudKey": "id",
|
||||||
|
"callbacks": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responseMode": "RANDOM"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"rootChildren": [
|
||||||
|
{
|
||||||
|
"type": "route",
|
||||||
|
"uuid": "b8a7a9df-6d18-46ca-9f55-87385b1654cd"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "route",
|
||||||
|
"uuid": "3d598a24-8088-43b4-a221-2296a7d7dc0b"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "route",
|
||||||
|
"uuid": "18a929f9-e616-4cf6-a67e-0950e1248ce8"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"proxyMode": false,
|
||||||
|
"proxyHost": "",
|
||||||
|
"proxyRemovePrefix": false,
|
||||||
|
"tlsOptions": {
|
||||||
|
"enabled": false,
|
||||||
|
"type": "CERT",
|
||||||
|
"pfxPath": "",
|
||||||
|
"certPath": "",
|
||||||
|
"keyPath": "",
|
||||||
|
"caPath": "",
|
||||||
|
"passphrase": ""
|
||||||
|
},
|
||||||
|
"cors": true,
|
||||||
|
"headers": [
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"proxyReqHeaders": [
|
||||||
|
{
|
||||||
|
"key": "",
|
||||||
|
"value": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"proxyResHeaders": [
|
||||||
|
{
|
||||||
|
"key": "",
|
||||||
|
"value": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"data": [
|
||||||
|
{
|
||||||
|
"uuid": "44f1e367-1b0c-4008-bb76-2f2547adeea2",
|
||||||
|
"id": "pwev",
|
||||||
|
"name": "WolvesCommittees",
|
||||||
|
"documentation": "",
|
||||||
|
"value": "[\n {{#repeat 1 20}}\n {{setVar 'name' (faker 'internet.userName')}}\n {\n \"id\": \"{{int 100 500}}\",\n \"name\": \"{{@name}}\",\n \"link\": \"https://ulwolves.ie/society/{{@name}}\",\n \"committee\": [\n {{#repeat 1 10}}\n \"{{int 1000 5000}}\",\n {{/repeat}}\n ]\n }\n {{/repeat}}\n]"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"uuid": "58843751-e03b-49e0-96d5-c9449deae514",
|
||||||
|
"id": "nejb",
|
||||||
|
"name": "WolvesMembers",
|
||||||
|
"documentation": "",
|
||||||
|
"value": "\n[\n \n {{#repeat 1 20}} \n {\n {{! Name of the Club/Soc}}\n \"committee\": \"Computer\",\n \"member_id\": \"{{int 100 500}}\",\n \"first_name\": \"{{firstName}}\",\n \"last_name\": \"{{lastName}}\",\n \"contact_email\": \"{{email}}\",\n \"opt_in_email\": \"{{oneOf (array '0' '1')}}\",\n \"student_id\": {{{oneOf (array 'null' '\"24123456\"' )}}},\n \"note\": {{{oneOf (array 'null' '\"note\"')}}},\n \"expiry\": \"{{date '2020-11-20' '2026-11-25' 'yyyy-MM-dd HH:mm:ss'}}\",\n \"requested\": \"{{date '2020-11-20' '2026-11-25' 'yyyy-MM-dd HH:mm:ss'}}\",\n \"approved\": \"{{date '2020-11-20' '2026-11-25' 'yyyy-MM-dd HH:mm:ss'}}\",\n \"sitename\":\"UL Wolves\",\n \"domain\":\"ulwolves.ie\"\n }\n {{/repeat}}\n]\n"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"uuid": "208bfc7f-ef60-4fdd-be8d-44bcfe48d264",
|
||||||
|
"id": "ef36",
|
||||||
|
"name": "WolvesMember",
|
||||||
|
"documentation": "",
|
||||||
|
"value": "{\n \"member_id\": \"{{int 100 500}}\",\n \"contact_email\": \"{{email}}\"\n}\n"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"callbacks": []
|
||||||
|
}
|
Loading…
Reference in a new issue