Dockerfile changes, move.test.js changes

This commit is contained in:
Schneider Roland 2022-09-28 21:55:44 +02:00
parent ae0b27a1bf
commit 4d42e1afca
5 changed files with 32 additions and 8 deletions

View File

@ -46,7 +46,7 @@ COPY index.html /var/www/html/
COPY apache2.conf /etc/apache2/ COPY apache2.conf /etc/apache2/
RUN apt-get install -y certbot python3-certbot-apache RUN #apt-get install -y certbot python3-certbot-apache
# Ports # Ports
EXPOSE 80 EXPOSE 80

View File

@ -6,5 +6,9 @@
"dev": { "dev": {
"restapi-url": "http://localhost:86/fitness_web/rest/web/index.php?r=", "restapi-url": "http://localhost:86/fitness_web/rest/web/index.php?r=",
"token": "123" "token": "123"
},
"dev1": {
"restapi-url": "http://localhost:42001/cutler/rest/web/index.php?r=",
"token": "123"
} }
} }

View File

@ -12,12 +12,13 @@ Content-Type: application/json
POST {{restapi-url}}door/move POST {{restapi-url}}door/move
Accept: application/json Accept: application/json
Content-Type: application/json Content-Type: application/json
Authorization: Basic bGd5ZW5lc2U6ZGlnaXNvZnQ=' Authorization: Basic ZG9vcl9zeXN0ZW06ZG9vcnN5c3RlbTE=
{ {
"cardNumber": "10WMVXMZ", "cardNumber": "10WMVXMZ",
"direction": "IN", "direction": "OUT",
"device": "Q" "device": "C",
"validateOnly": false
} }
### ###
@ -30,5 +31,6 @@ Authorization: Basic ZG9vcl9zeXN0ZW06ZG9vcnN5c3RlbTE=
{ {
"cardNumber": "10WMVXMZ", "cardNumber": "10WMVXMZ",
"direction": "IN", "direction": "IN",
"device": "Q" "device": "C",
"validateOnly": false
} }

View File

@ -18,7 +18,7 @@ class DoorMoveForm extends Model
public function rules( ) { public function rules( ) {
return [ return [
[ [ 'device', 'validateOnly' ], 'required'], [ [ 'device', 'validateOnly' ], 'required'],
[ [ 'cardNumber', 'device', 'direction', 'validateOnly' , 'createdAt', 'date' ], 'string'] [ [ 'cardNumber', 'device', 'direction', 'createdAt', 'date' ], 'string']
]; ];
} }

View File

@ -2,7 +2,7 @@
// const {test, expect} = require('jest') // const {test, expect} = require('jest')
const axios = require('axios'); 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 auth = "Basic ZG9vcl9zeXN0ZW06ZG9vcnN5c3RlbTE=";
const TEST_CARD_NUMBER = "10WMVXMZ"; const TEST_CARD_NUMBER = "10WMVXMZ";
const TEST_KEY = "f100"; const TEST_KEY = "f100";
@ -38,6 +38,24 @@ test('Testing to see if Jest works', () => {
expect(1).toBe(1) 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 { class Client {
@ -66,7 +84,7 @@ class Client {
...headers ...headers
}, },
data: { data: {
verifyOnly: false, // verifyOnly: false,
direction: 'IN', direction: 'IN',
device: 'Q', device: 'Q',
validateOnly: false, validateOnly: false,