Skip to content

Commit

Permalink
Updated auth acceptance test style.
Browse files Browse the repository at this point in the history
  • Loading branch information
slaskis authored and tj committed Feb 18, 2012
1 parent 9290f0d commit 0dd5836
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions test/acceptance/auth.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
var app = require('../../examples/auth/app')
, request = require('../support/http')
, should = require('should');
, request = require('../support/http');

describe('examples', function(){
describe('auth', function(){
var cookie;
describe('auth', function(){
var cookie;
describe('GET /',function(){
it('should redirect to /login', function(done){
request(app)
.get('/')
Expand All @@ -14,7 +13,9 @@ describe('examples', function(){
done();
})
})
it('should be restricted', function(done){
})
describe('GET /restricted (w/o cookie)',function(){
it('should redirect to /login', function(done){
request(app)
.get('/restricted')
.end(function(res){
Expand All @@ -23,7 +24,9 @@ describe('examples', function(){
done();
})
})
it('should fail to authenticate', function(done){
})
describe('POST /login', function(){
it('should fail without proper credentials', function(done){
request(app)
.post('/login')
.write('&username=not-tj&password=foobar')
Expand All @@ -46,13 +49,17 @@ describe('examples', function(){
done();
})
})
it('should not be restricted with an authenticated session cookie',function(done){
})
describe('GET /restricted (w. cookie)',function(){
it('should respond with 200',function(done){
request(app)
.get('/restricted')
.set('cookie',cookie)
.expect(200,done)
})
it('should logout',function(done){
})
describe('GET /logout',function(){
it('should respond with 302 and clear cookie',function(done){
request(app)
.get('/logout')
.set('cookie',cookie)
Expand All @@ -62,7 +69,9 @@ describe('examples', function(){
done();
})
})
it('should be restricted again',function(done){
})
describe('GET /restricted (w. expired cookie)',function(){
it('should respond with 302',function(done){
request(app)
.get('/restricted')
.set('cookie',cookie)
Expand Down

0 comments on commit 0dd5836

Please sign in to comment.