@@ -66,26 +66,55 @@ describe('Identity Provider', function () {
6666 } )
6767 } )
6868
69+ describe ( 'generating a certificate' , function ( ) {
70+ beforeEach ( function ( ) {
71+ rm ( 'accounts/nicola.localhost' )
72+ } )
73+ after ( function ( ) {
74+ rm ( 'accounts/nicola.localhost' )
75+ } )
76+
77+ it ( 'should not generate a certificate if spkac is not valid' , function ( done ) {
78+ var subdomain = supertest ( 'https://nicola.' + host )
79+ subdomain . post ( '/accounts/new' )
80+ . send ( 'username=nicola' )
81+ . expect ( 200 )
82+ . end ( function ( err ) {
83+ if ( err ) return done ( err )
84+
85+ var spkac = ''
86+ subdomain . post ( '/accounts/cert' )
87+ . send ( 'webid=https://nicola.' + host + '/profile/card#me&spkac=' + spkac )
88+ . expect ( 500 , done )
89+ } )
90+ } )
91+ } )
92+
6993 describe ( 'creating an account with POST' , function ( ) {
94+ beforeEach ( function ( ) {
95+ rm ( 'accounts/nicola.localhost' )
96+ } )
97+
98+ after ( function ( ) {
99+ rm ( 'accounts/nicola.localhost' )
100+ } )
101+
70102 it ( 'should return 406 if username is not given' , function ( done ) {
71103 var subdomain = supertest ( 'https://nicola.' + host )
72104 subdomain . post ( '/accounts/new' )
73105 . expect ( 406 , done )
74106 } )
75107 it ( 'should return create WebID if only username is given' , function ( done ) {
76- rm ( 'accounts/nicola.localhost' )
77108 var subdomain = supertest ( 'https://nicola.' + host )
78109 subdomain . post ( '/accounts/new' )
79110 . send ( 'username=nicola' )
80111 . expect ( 200 )
81112 . end ( function ( err ) {
82- rm ( 'accounts/nicola.localhost' )
83113 done ( err )
84114 } )
85115 } )
86116
87117 it ( 'should not create a WebID if it already exists' , function ( done ) {
88- rm ( 'accounts/nicola.localhost' )
89118 var subdomain = supertest ( 'https://nicola.' + host )
90119 subdomain . post ( '/accounts/new' )
91120 . send ( 'username=nicola' )
@@ -98,7 +127,6 @@ describe('Identity Provider', function () {
98127 . send ( 'username=nicola' )
99128 . expect ( 406 )
100129 . end ( function ( err ) {
101- rm ( 'accounts/nicola.' + host )
102130 done ( err )
103131 } )
104132 } )
0 commit comments