mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-01-31 08:25:36 +00:00
Move token as an auth submodule
This commit is contained in:
parent
46ebb7b1fd
commit
be08a83765
@ -1,7 +1,7 @@
|
||||
async = require('async')
|
||||
_ = require('lodash-contrib')
|
||||
|
||||
token = require('../token/token')
|
||||
token = require('./token/token')
|
||||
server = require('../server/server')
|
||||
data = require('../data/data')
|
||||
errors = require('../errors/errors')
|
||||
|
@ -1,4 +1,4 @@
|
||||
data = require('../data/data')
|
||||
data = require('../../data/data')
|
||||
|
||||
# @nodoc
|
||||
# TODO: Move to settings
|
@ -1,12 +1,12 @@
|
||||
expect = require('chai').expect
|
||||
async = require('async')
|
||||
token = require('./token')
|
||||
settings = require('../settings')
|
||||
data = require('../data/data')
|
||||
mock = require('../../../tests/utils/mock')
|
||||
settings = require('../../settings')
|
||||
data = require('../../data/data')
|
||||
mock = require('../../../../tests/utils/mock')
|
||||
|
||||
johnDoeFixture = require('../../../tests/fixtures/johndoe.json')
|
||||
janeDoeFixture = require('../../../tests/fixtures/janedoe.json')
|
||||
johnDoeFixture = require('../../../../tests/fixtures/johndoe.json')
|
||||
janeDoeFixture = require('../../../../tests/fixtures/janedoe.json')
|
||||
|
||||
describe 'Token:', ->
|
||||
|
@ -2,7 +2,6 @@ module.exports =
|
||||
server: require('./server/server')
|
||||
models: require('./models')
|
||||
errors: require('./errors/errors')
|
||||
token: require('./token/token')
|
||||
data: require('./data/data')
|
||||
auth: require('./auth/auth')
|
||||
device: require('./device/device')
|
||||
|
@ -4,7 +4,7 @@ progress = require('request-progress')
|
||||
async = require('async')
|
||||
connection = require('../../connection/connection')
|
||||
settings = require('../settings')
|
||||
token = require('../token/token')
|
||||
auth = require('../auth/auth')
|
||||
|
||||
# @nodoc
|
||||
urlResolve = require('url').resolve
|
||||
@ -72,7 +72,7 @@ exports.request = (options = {}, outerCallback, onProgress) ->
|
||||
if not isOnline
|
||||
return callback(new Error('You need internet connection to perform this task'))
|
||||
|
||||
token.getToken(callback)
|
||||
auth.getToken(callback)
|
||||
|
||||
(savedToken, callback) ->
|
||||
options.url = urlResolve(settings.get('remoteUrl'), options.url)
|
||||
|
@ -5,7 +5,7 @@ url = require('url')
|
||||
sinon = require('sinon')
|
||||
server = require('./server')
|
||||
settings = require('../settings')
|
||||
token = require('../token/token')
|
||||
auth = require('../auth/auth')
|
||||
data = require('../data/data')
|
||||
mock = require('../../../tests/utils/mock')
|
||||
johnDoeFixture = require('../../../tests/fixtures/johndoe.json')
|
||||
@ -200,7 +200,11 @@ describe 'Server:', ->
|
||||
describe 'given there is a token', ->
|
||||
|
||||
beforeEach (done) ->
|
||||
token.saveToken(johnDoeFixture.token, done)
|
||||
nock(settings.get('remoteUrl'))
|
||||
.post('/login_', johnDoeFixture.credentials)
|
||||
.reply(200, johnDoeFixture.token)
|
||||
|
||||
auth.login(johnDoeFixture.credentials, done)
|
||||
|
||||
describe '#request()', ->
|
||||
|
||||
@ -220,7 +224,7 @@ describe 'Server:', ->
|
||||
describe 'given there is not a token', ->
|
||||
|
||||
beforeEach (done) ->
|
||||
token.clearToken(done)
|
||||
auth.logout(done)
|
||||
|
||||
describe '#request()', ->
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user