mirror of
https://github.com/documize/community.git
synced 2025-08-08 06:55:28 +02:00
Add and use authenticateUser session helper
This commit is contained in:
parent
dc164f2f63
commit
42a88bb441
3 changed files with 39 additions and 1 deletions
38
app/tests/helpers/authenticate-user.js
Normal file
38
app/tests/helpers/authenticate-user.js
Normal file
|
@ -0,0 +1,38 @@
|
|||
import Ember from 'ember';
|
||||
import { authenticateSession } from 'documize/tests/helpers/ember-simple-auth';
|
||||
|
||||
const {
|
||||
merge
|
||||
} = Ember;
|
||||
|
||||
export default Ember.Test.registerAsyncHelper('authenticateUser', function(app, attrs = {}) {
|
||||
authenticateSession(app, merge({
|
||||
token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkb21haW4iOiIiLCJleHAiOjE0NjQwMjM2NjcsImlzcyI6IkRvY3VtaXplIiwib3JnIjoiVnpNdXlFd18zV3FpYWZjRCIsInN1YiI6IndlYmFwcCIsInVzZXIiOiJWek11eUV3XzNXcWlhZmNFIn0.NXZ6bo8mtvdZF_b9HavbidVUJqhmBA1zr0fSAPvbah0",
|
||||
user: {
|
||||
"id": "VzMuyEw_3WqiafcE",
|
||||
"created": "2016-05-11T15:08:24Z",
|
||||
"revised": "2016-05-11T15:08:24Z",
|
||||
"firstname": "Lennex",
|
||||
"lastname": "Zinyando",
|
||||
"email": "brizdigital@gmail.com",
|
||||
"initials": "LZ",
|
||||
"active": true,
|
||||
"editor": true,
|
||||
"admin": true,
|
||||
"accounts": [{
|
||||
"id": "VzMuyEw_3WqiafcF",
|
||||
"created": "2016-05-11T15:08:24Z",
|
||||
"revised": "2016-05-11T15:08:24Z",
|
||||
"admin": true,
|
||||
"editor": true,
|
||||
"userId": "VzMuyEw_3WqiafcE",
|
||||
"orgId": "VzMuyEw_3WqiafcD",
|
||||
"company": "EmberSherpa",
|
||||
"title": "EmberSherpa",
|
||||
"message": "This Documize instance contains all our team documentation",
|
||||
"domain": ""
|
||||
}]
|
||||
}
|
||||
}, attrs)
|
||||
);
|
||||
});
|
|
@ -7,7 +7,6 @@ export default function(name, options = {}) {
|
|||
beforeEach() {
|
||||
this.application = startApp();
|
||||
stubAudit(this);
|
||||
stubSession(this);
|
||||
stubUserNotification(this);
|
||||
|
||||
if (options.beforeEach) {
|
||||
|
|
|
@ -7,6 +7,7 @@ import './user-login';
|
|||
import './wait-to-appear';
|
||||
import './wait-to-disappear';
|
||||
import './stub-user-notification';
|
||||
import './authenticate-user';
|
||||
|
||||
export default function startApp(attrs) {
|
||||
let application;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue