github.com/jancarloviray/community@v0.41.1-0.20170124221257-33a66c87cf2f/app/tests/helpers/authenticate-user.js (about)

     1  // Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
     2  //
     3  // This software (Documize Community Edition) is licensed under 
     4  // GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
     5  //
     6  // You can operate outside the AGPL restrictions by purchasing
     7  // Documize Enterprise Edition and obtaining a commercial license
     8  // by contacting <sales@documize.com>. 
     9  //
    10  // https://documize.com
    11  
    12  import Ember from 'ember';
    13  import { authenticateSession } from 'documize/tests/helpers/ember-simple-auth';
    14  
    15  const {
    16  	merge
    17  } = Ember;
    18  
    19  export default Ember.Test.registerAsyncHelper('authenticateUser', function (app, attrs = {}) {
    20  	authenticateSession(app, merge({
    21  		token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkb21haW4iOiIiLCJleHAiOjE0NjQwMjM2NjcsImlzcyI6IkRvY3VtaXplIiwib3JnIjoiVnpNdXlFd18zV3FpYWZjRCIsInN1YiI6IndlYmFwcCIsInVzZXIiOiJWek11eUV3XzNXcWlhZmNFIn0.NXZ6bo8mtvdZF_b9HavbidVUJqhmBA1zr0fSAPvbah0",
    22  		user: {
    23  			"id": "VzMuyEw_3WqiafcE",
    24  			"created": "2016-05-11T15:08:24Z",
    25  			"revised": "2016-05-11T15:08:24Z",
    26  			"firstname": "Lennex",
    27  			"lastname": "Zinyando",
    28  			"email": "brizdigital@gmail.com",
    29  			"initials": "LZ",
    30  			"active": true,
    31  			"editor": true,
    32  			"admin": true,
    33  			"accounts": [{
    34  				"id": "VzMuyEw_3WqiafcF",
    35  				"created": "2016-05-11T15:08:24Z",
    36  				"revised": "2016-05-11T15:08:24Z",
    37  				"admin": true,
    38  				"editor": true,
    39  				"userId": "VzMuyEw_3WqiafcE",
    40  				"orgId": "VzMuyEw_3WqiafcD",
    41  				"company": "EmberSherpa",
    42  				"title": "EmberSherpa",
    43  				"message": "This Documize instance contains all our team documentation",
    44  				"domain": ""
    45  			}]
    46  		}
    47  	}, attrs));
    48  });