From 4d42e1afcacacd5ef2f8d426bb7926515a7207e4 Mon Sep 17 00:00:00 2001 From: Schneider Roland Date: Wed, 28 Sep 2022 21:55:44 +0200 Subject: [PATCH] Dockerfile changes, move.test.js changes --- docker/fitness/service/apache2/Dockerfile | 2 +- http-client.env.json | 4 ++++ rest.http | 10 ++++++---- rest/models/DoorMoveForm.php | 2 +- test/src/rest/move.test.js | 22 ++++++++++++++++++++-- 5 files changed, 32 insertions(+), 8 deletions(-) diff --git a/docker/fitness/service/apache2/Dockerfile b/docker/fitness/service/apache2/Dockerfile index 711956c..f6dc2eb 100644 --- a/docker/fitness/service/apache2/Dockerfile +++ b/docker/fitness/service/apache2/Dockerfile @@ -46,7 +46,7 @@ COPY index.html /var/www/html/ COPY apache2.conf /etc/apache2/ -RUN apt-get install -y certbot python3-certbot-apache +RUN #apt-get install -y certbot python3-certbot-apache # Ports EXPOSE 80 diff --git a/http-client.env.json b/http-client.env.json index 3fedd0f..64b8e80 100644 --- a/http-client.env.json +++ b/http-client.env.json @@ -6,5 +6,9 @@ "dev": { "restapi-url": "http://localhost:86/fitness_web/rest/web/index.php?r=", "token": "123" + }, + "dev1": { + "restapi-url": "http://localhost:42001/cutler/rest/web/index.php?r=", + "token": "123" } } diff --git a/rest.http b/rest.http index 304df25..a1dbf8f 100644 --- a/rest.http +++ b/rest.http @@ -12,12 +12,13 @@ Content-Type: application/json POST {{restapi-url}}door/move Accept: application/json Content-Type: application/json -Authorization: Basic bGd5ZW5lc2U6ZGlnaXNvZnQ=' +Authorization: Basic ZG9vcl9zeXN0ZW06ZG9vcnN5c3RlbTE= { "cardNumber": "10WMVXMZ", - "direction": "IN", - "device": "Q" + "direction": "OUT", + "device": "C", + "validateOnly": false } ### @@ -30,5 +31,6 @@ Authorization: Basic ZG9vcl9zeXN0ZW06ZG9vcnN5c3RlbTE= { "cardNumber": "10WMVXMZ", "direction": "IN", - "device": "Q" + "device": "C", + "validateOnly": false } diff --git a/rest/models/DoorMoveForm.php b/rest/models/DoorMoveForm.php index a9d1704..0551791 100644 --- a/rest/models/DoorMoveForm.php +++ b/rest/models/DoorMoveForm.php @@ -18,7 +18,7 @@ class DoorMoveForm extends Model public function rules( ) { return [ [ [ 'device', 'validateOnly' ], 'required'], - [ [ 'cardNumber', 'device', 'direction', 'validateOnly' , 'createdAt', 'date' ], 'string'] + [ [ 'cardNumber', 'device', 'direction', 'createdAt', 'date' ], 'string'] ]; } diff --git a/test/src/rest/move.test.js b/test/src/rest/move.test.js index 0bab6d0..9692542 100644 --- a/test/src/rest/move.test.js +++ b/test/src/rest/move.test.js @@ -2,7 +2,7 @@ // const {test, expect} = require('jest') const axios = require('axios'); -const url = 'http://localhost:86/fitness_web/rest/web/index.php?r='; +const url = 'http://localhost:42001/cutler/rest/web/index.php?r='; const auth = "Basic ZG9vcl9zeXN0ZW06ZG9vcnN5c3RlbTE="; const TEST_CARD_NUMBER = "10WMVXMZ"; const TEST_KEY = "f100"; @@ -38,6 +38,24 @@ test('Testing to see if Jest works', () => { expect(1).toBe(1) }) +axios.interceptors.request.use(request => { + // console.info(request.url); + // console.log('Starting Request', JSON.stringify(request, null, 2)) + return request +}); + +axios.interceptors.response.use(response => { + console.info(response.status); + if ( response.status >=400){ + console.info(response.request.url) + console.info(response.request.data) + } + // console.info(response.url); + // console.log('Response:', JSON.stringify(response.status , null, 2)) + // console.log('Response:', JSON.stringify(response.statusText , null, 2)) + return response +}) + class Client { @@ -66,7 +84,7 @@ class Client { ...headers }, data: { - verifyOnly: false, + // verifyOnly: false, direction: 'IN', device: 'Q', validateOnly: false,