strapi/test/helpers/auth.js

26 lines
412 B
JavaScript
Raw Normal View History

2019-03-08 17:54:45 +01:00
const createRq = require('./request');
2018-07-19 14:46:03 +02:00
const auth = {
username: 'admin',
email: 'admin@strapi.io',
2019-03-08 17:54:45 +01:00
password: 'pcw123',
2018-07-19 14:46:03 +02:00
};
2019-03-08 17:54:45 +01:00
const rq = createRq();
2018-07-19 14:46:03 +02:00
module.exports = {
auth,
2019-03-09 01:06:39 +01:00
login: async () => {
const { body } = await rq({
2019-04-09 18:35:49 +02:00
url: '/admin/auth/local',
2019-03-09 01:06:39 +01:00
method: 'POST',
body: {
identifier: auth.email,
password: auth.password,
},
2018-07-19 14:46:03 +02:00
});
2019-03-09 01:06:39 +01:00
return body;
2019-03-08 17:54:45 +01:00
},
2018-07-19 14:46:03 +02:00
};