File tree Expand file tree Collapse file tree 1 file changed +22
-2
lines changed
Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -11,10 +11,30 @@ test("Basic Auth - Pass", function(t) {
1111 } ) ;
1212 var user = github . getUser ( ) ;
1313
14- t . equals ( Object . keys ( user ) . length , 10 ) ;
15- t . equals ( Object . keys ( user ) . indexOf ( 'repos' ) > - 1 , true ) ;
14+ user . notifications ( function ( err , res ) {
15+ t . error ( err , 'user is authd' ) ;
16+ } ) ;
17+
1618 clearTimeout ( timeout ) ;
1719 t . end ( ) ;
1820
1921} ) ;
2022
23+ test ( "Basic Auth - Fail" , function ( t ) {
24+ var timeout = setTimeout ( function ( ) { t . fail ( ) ; } , 10000 ) ;
25+ var github = new Github ( {
26+ username : test_user . USERNAME ,
27+ password : 'fake124' ,
28+ auth : "basic"
29+ } ) ;
30+ var user = github . getUser ( ) ;
31+
32+ user . notifications ( function ( err , res ) {
33+ t . ok ( err , 'user is not authd' ) ;
34+ t . equals ( JSON . parse ( err . request . responseText ) . message , 'Bad credentials' , 'confirm error' ) ;
35+ } ) ;
36+
37+ clearTimeout ( timeout ) ;
38+ t . end ( ) ;
39+
40+ } ) ;
You can’t perform that action at this time.
0 commit comments