Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
lynndylanhurley committed Oct 15, 2014
1 parent 1eb1709 commit 5a06887
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/test/unit/ng-token-auth/token-handling.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,32 @@ suite 'token handling', ->
$timeout.flush()


suite 'error response containing tokens', ->
setup ->
$httpBackend
.expectGET('/api/err')
.respond(401, errorResp, newAuthHeader)

$cookieStore.put('auth_headers', validAuthHeader)
dfd = $http.get('/api/err')
$httpBackend.flush()

test 'headers should be updated', ->
assert.deepEqual(newAuthHeader, $auth.retrieveData('auth_headers'))

test 'header is included with the next request to the api', ->
$httpBackend
.expectGET('/api/test', (headers) ->
assert.equal(newAuthHeader['access-token'], headers['access-token'])
headers
)
.respond(201, successResp, {'access-token', 'whatever'})

$http.get('/api/test')

$httpBackend.flush()


suite 'invalid headers', ->
setup ->
$httpBackend
Expand Down

0 comments on commit 5a06887

Please sign in to comment.