parent
63f6526e4f
commit
383a8095b8
|
@ -0,0 +1,39 @@
|
|||
import axios from 'axios';
|
||||
import { config } from '../../config';
|
||||
|
||||
const base = "http://localhost:" + config.internal_port
|
||||
|
||||
let axios_config = {};
|
||||
|
||||
beforeAll(async () => {
|
||||
jest.setTimeout(20000);
|
||||
const res = await axios.post(base + '/api/auth/login', { username: "demo", password: "demo" });
|
||||
let access_token = res.data["access_token"];
|
||||
axios_config = {
|
||||
headers: { "authorization": "Bearer " + access_token },
|
||||
validateStatus: undefined
|
||||
};
|
||||
});
|
||||
|
||||
describe('POST /api/users valid', () => {
|
||||
it('valid user creation with minimal parameters should return 200', async () => {
|
||||
const res = await axios.post(base + '/api/users', {
|
||||
"firstname": "demo_createASD123",
|
||||
"lastname": "demo_createASD123",
|
||||
"password": "demo_createASD123",
|
||||
"email": "demo_createASD123@dev.lauf-fuer-kaya.de"
|
||||
}, axios_config);
|
||||
expect(res.status).toEqual(200);
|
||||
});
|
||||
it('valid user creation with all parameters should return 200', async () => {
|
||||
const res = await axios.post(base + '/api/users', {
|
||||
"firstname": "demo_createASD123_2",
|
||||
"middlename": "demo_createASD123_2",
|
||||
"lastname": "demo_createASD123_2",
|
||||
"username": "demo_createASD123_2",
|
||||
"password": "demo_createASD123_2",
|
||||
"email": "demo_createASD123_2@dev.lauf-fuer-kaya.de"
|
||||
}, axios_config);
|
||||
expect(res.status).toEqual(200);
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue