correct apib config and add dredd test data import/export + working run
parent
c3f5c3f971
commit
e284fffdee
|
@ -25,7 +25,7 @@ In addition, it sets up the mongo deamon to start up automatically with the syst
|
||||||
|
|
||||||
For production setup run the script, described in _Setup for development_, adding the parameter `prod`
|
For production setup run the script, described in _Setup for development_, adding the parameter `prod`
|
||||||
|
|
||||||
./docs/opt-cc-environment/3rd-party-install.sh prod
|
./docs/opt-cc-environment/3rd-party-install.sh prod
|
||||||
|
|
||||||
This adds the [`pm2` process manager](http://pm2.keymetrics.io/) to be installed and start the _opt-cc_ server as `pm2` process.
|
This adds the [`pm2` process manager](http://pm2.keymetrics.io/) to be installed and start the _opt-cc_ server as `pm2` process.
|
||||||
Run the `sudo` command printed as last output to configure the `pm2` process for automatic start on the system.
|
Run the `sudo` command printed as last output to configure the `pm2` process for automatic start on the system.
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
### GET User [GET /users/:id]
|
### GET User [GET /users/{id}]
|
||||||
|
|
||||||
Get single army member information
|
Get single army member information
|
||||||
|
|
||||||
|
+ Parameters
|
||||||
|
+ id: `5ab68d42f547ed304064e5f7` (string, required) - unique id of army-member
|
||||||
|
|
||||||
+ Response 200
|
+ Response 200
|
||||||
|
|
||||||
+ Attributes (User)
|
+ Attributes (User)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
Generate a token which can be used to make API requests.
|
Generate a token which can be used to make API requests.
|
||||||
|
|
||||||
+ Request Generate Token
|
+ Request Generate Token (application/json)
|
||||||
|
|
||||||
+ Attributes (Login)
|
+ Attributes (Login)
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
Create a new application user account.
|
Create a new application user account.
|
||||||
|
|
||||||
+ Request Create Account
|
+ Request Create Account (application/json)
|
||||||
|
|
||||||
+ Attributes (Registration)
|
+ Attributes (Registration)
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ User related entity for creating a token using application credentials
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
|
||||||
+ username: `hardiready` (string, required) - username of the app-user
|
+ username: `testuser` (string, required) - username of the app-user
|
||||||
+ password: `password` (string, required) - password of the app-user
|
+ password: `password` (string, required) - password of the app-user
|
||||||
|
|
||||||
# LoginResponse (object)
|
# LoginResponse (object)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
A participant managed in the system
|
A participant managed in the system
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
+ _id: `5918d2ca574b0b1d820a0b24` (string, required) - unique id of the army member
|
+ _id: `5ab68d42f547ed304064e5f7` (string, required) - unique id of the army member
|
||||||
+ username: `Jagernaut` - the displayed username of the army member
|
+ username: `Jagernaut` - the displayed username of the army member
|
||||||
+ rankLvl: 22 (number, required) - rank level representing the rank
|
+ rankLvl: 22 (number, required) - rank level representing the rank
|
||||||
+ squadId (Squad, required) - populated squad which the army member is part of
|
+ squadId (Squad, required) - populated squad which the army member is part of
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
{"_id":{"$oid":"5ab68ceef547ed304064e5f6"},"squad":null,"permission":3,"activated":true,"username":"testuser","secret":"my secret","password":"$2a$10$wvgBbcckHrFu8Ctw8hSPNuFLoBy4sRubioyiK1NabOC0UgYD.KITi","timestamp":{"$date":"2018-03-24T17:37:50.668Z"},"updatedAt":{"$date":"2018-03-24T17:37:50.668Z"},"__v":0}
|
|
@ -0,0 +1 @@
|
||||||
|
{"_id":{"$oid":"5ab68d42f547ed304064e5f7"},"rankLvl":0,"squadId":null,"username":"user1","timestamp":{"$date":"2018-03-24T17:39:14.841Z"},"updatedAt":{"$date":"2018-03-24T17:39:14.841Z"},"__v":0}
|
|
@ -0,0 +1,29 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
########## IMPORT EXPORT/SCRIPT FOR DREDD TEST DATA ############
|
||||||
|
###----------------------------------------------------------###
|
||||||
|
###------------------ HOW TO USE THIS FILE ------------------###
|
||||||
|
###----------------------------------------------------------###
|
||||||
|
### 1. start express server with `npm run start-test` ###
|
||||||
|
### 2. import data by executing script: `./populate-data.sh` ###
|
||||||
|
### 3. change data in app as you need for tests ###
|
||||||
|
### 4. export data state with: `./populate-data.sh save` ###
|
||||||
|
################################################################
|
||||||
|
|
||||||
|
# execute script in its location folder
|
||||||
|
cd $(dirname $0)
|
||||||
|
|
||||||
|
# array of available collection names
|
||||||
|
col=(app_user awarding campaign decoration logBudget logFlag logKill logPoints logRespawn logRevive logTransport player promotion rank squad user war )
|
||||||
|
|
||||||
|
for i in "${col[@]}"
|
||||||
|
do
|
||||||
|
# provide date for restore process, if data import is needed
|
||||||
|
if [ "$1" == "save" ]
|
||||||
|
then
|
||||||
|
echo -e "$(date "+%Y-%m-%dT%T.%3N%z")\tTable: ${i}"
|
||||||
|
mongoexport --db cc-test --collection $i --out data/${i}.json;
|
||||||
|
else
|
||||||
|
mongoimport --db cc-test --collection $i --drop --file data/${i}.json
|
||||||
|
fi
|
||||||
|
done
|
|
@ -14,7 +14,7 @@
|
||||||
"start-test": "DEBUG='cc:*' NODE_ENV=test node server.js",
|
"start-test": "DEBUG='cc:*' NODE_ENV=test node server.js",
|
||||||
"api:compile-docs": "$(npm bin)/hercule apib/dev-doc.apib -o apib/documentation.apib",
|
"api:compile-docs": "$(npm bin)/hercule apib/dev-doc.apib -o apib/documentation.apib",
|
||||||
"api:publish-docs": "$(npm bin)/aglio --theme-variables slate -i ./apib/documentation.apib -o ../public/api-docs.html",
|
"api:publish-docs": "$(npm bin)/aglio --theme-variables slate -i ./apib/documentation.apib -o ../public/api-docs.html",
|
||||||
"api:test-docs": "$(npm bin)/dredd",
|
"api:test-docs": "npm run api:docs && ./apib/dredd/populate-data.sh && $(npm bin)/dredd",
|
||||||
"api:docs": "npm run api:compile-docs && npm run api:publish-docs"
|
"api:docs": "npm run api:compile-docs && npm run api:publish-docs"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -78,7 +78,7 @@ authenticate.route('/signup')
|
||||||
.post((req, res, next) => {
|
.post((req, res, next) => {
|
||||||
create(req.body)
|
create(req.body)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
res.sendStatus(200);
|
res.sendStatus(201);
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
res.status(400).send(err);
|
res.status(400).send(err);
|
||||||
|
|
|
@ -15,7 +15,8 @@
|
||||||
"test": "npm test --prefix ./api",
|
"test": "npm test --prefix ./api",
|
||||||
"e2e": "npm run deploy-static && concurrently \"npm run start-test --prefix ./api\" \"wait-on -t 60000 http://localhost:3001/ && npm run e2e --prefix ./static\" --success first --kill-others",
|
"e2e": "npm run deploy-static && concurrently \"npm run start-test --prefix ./api\" \"wait-on -t 60000 http://localhost:3001/ && npm run e2e --prefix ./static\" --success first --kill-others",
|
||||||
"start-e2e": "npm run deploy-static && npm run start-test --prefix ./api",
|
"start-e2e": "npm run deploy-static && npm run start-test --prefix ./api",
|
||||||
"test-e2e": "npm run e2e --prefix ./static"
|
"test-e2e": "npm run e2e --prefix ./static",
|
||||||
|
"test-api": "npm run api:test-docs --prefix ./api"
|
||||||
},
|
},
|
||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
Loading…
Reference in New Issue