@@ -95,4 +95,43 @@ test('docker-cli-js', t => {
9595 } ) ;
9696 } ) ;
9797
98+ t . test ( 'login success' , t => {
99+
100+ let docker = new Docker ( ) ;
101+
102+ // if this these credentials ever fail, they should be replaced with new valid ones.
103+ return docker . command ( 'login -u myusername -p mypassword' ) . then ( function ( data ) {
104+ console . log ( 'data = ' , data ) ;
105+
106+ // if login succeeds, these tests should pass
107+ t . notOk ( / e r r o r / . test ( data ) ) ;
108+ t . ok ( data . login ) ;
109+ } , function ( data ) {
110+ console . log ( 'data = ' , data ) ;
111+
112+ // if login is rejected, these tests should fail
113+ t . notOk ( / e r r o r / . test ( data ) ) ;
114+ t . ok ( data . login ) ;
115+ } ) ;
116+ } ) ;
117+
118+ t . test ( 'login fail' , t => {
119+
120+ let docker = new Docker ( ) ;
121+
122+ return docker . command ( 'login -u fakeUsername -p fakePassword' ) . then ( function ( data ) {
123+ console . log ( 'data = ' , data ) ;
124+
125+ // if login succeeds, these tests should fail
126+ t . ok ( / e r r o r / . test ( data ) ) ;
127+ t . notOk ( data . login ) ;
128+ } , function ( data ) {
129+ console . log ( 'data = ' , data ) ;
130+
131+ // if login is rejected, these tests should pass
132+ t . ok ( / e r r o r / . test ( data ) ) ;
133+ t . notOk ( data . login ) ;
134+ } ) ;
135+ } ) ;
136+
98137} ) ;
0 commit comments