Updated tests for new login in selfservice
continuous-integration/drone/pr Build is passing
Details
continuous-integration/drone/pr Build is passing
Details
ref #197
This commit is contained in:
parent
19a290c3a9
commit
39aa7598b7
|
@ -15,20 +15,20 @@ beforeAll(async () => {
|
|||
};
|
||||
});
|
||||
|
||||
describe('POST /api/runners/me/forgot invalid syntax/mail should fail', () => {
|
||||
describe('POST /api/runners/me/login invalid syntax/mail should fail', () => {
|
||||
it('get without mail return 404', async () => {
|
||||
const res = await axios.post(base + '/api/runners/forgot', null, axios_config);
|
||||
const res = await axios.post(base + '/api/runners/login', null, axios_config);
|
||||
expect(res.status).toEqual(404);
|
||||
expect(res.headers['content-type']).toContain("application/json");
|
||||
});
|
||||
it('get without bs mail return 404', async () => {
|
||||
const res = await axios.post(base + '/api/runners/forgot?mail=asdasdasdasdasd@tester.test.dev.lauf-fuer-kaya.de', null, axios_config);
|
||||
const res = await axios.post(base + '/api/runners/login?mail=asdasdasdasdasd@tester.test.dev.lauf-fuer-kaya.de', null, axios_config);
|
||||
expect(res.status).toEqual(404);
|
||||
expect(res.headers['content-type']).toContain("application/json");
|
||||
});
|
||||
});
|
||||
// ---------------
|
||||
describe('POST /api/runners/me/forgot 2 times within timeout should fail', () => {
|
||||
describe('POST /api/runners/me/login 2 times within timeout should fail', () => {
|
||||
let added_runner;
|
||||
it('registering as citizen should return 200', async () => {
|
||||
const res = await axios.post(base + '/api/runners/register', {
|
||||
|
@ -42,19 +42,19 @@ describe('POST /api/runners/me/forgot 2 times within timeout should fail', () =>
|
|||
added_runner = res.data;
|
||||
});
|
||||
it('post with valid mail should return 200', async () => {
|
||||
const res = await axios.post(base + '/api/runners/forgot?mail=' + added_runner.email, null, axios_config);
|
||||
const res = await axios.post(base + '/api/runners/login?mail=' + added_runner.email, null, axios_config);
|
||||
expect(res.status).toEqual(200);
|
||||
expect(res.headers['content-type']).toContain("application/json");
|
||||
});
|
||||
it('2nd post with valid mail should return 406', async () => {
|
||||
const res = await axios.post(base + '/api/runners/forgot?mail=' + added_runner.email, null, axios_config);
|
||||
const res = await axios.post(base + '/api/runners/login?mail=' + added_runner.email, null, axios_config);
|
||||
expect(res.status).toEqual(406);
|
||||
expect(res.headers['content-type']).toContain("application/json");
|
||||
});
|
||||
});
|
||||
|
||||
// ---------------
|
||||
describe('POST /api/runners/me/forgot valid should return 200', () => {
|
||||
describe('POST /api/runners/me/login valid should return 200', () => {
|
||||
let added_runner;
|
||||
let new_token;
|
||||
it('registering as citizen should return 200', async () => {
|
||||
|
@ -69,7 +69,7 @@ describe('POST /api/runners/me/forgot valid should return 200', () => {
|
|||
added_runner = res.data;
|
||||
});
|
||||
it('post with valid mail should return 200', async () => {
|
||||
const res = await axios.post(base + '/api/runners/forgot?mail=' + added_runner.email, null, axios_config);
|
||||
const res = await axios.post(base + '/api/runners/login?mail=' + added_runner.email, null, axios_config);
|
||||
expect(res.status).toEqual(200);
|
||||
expect(res.headers['content-type']).toContain("application/json");
|
||||
new_token = res.data.token;
|
||||
|
|
Loading…
Reference in New Issue