@@ -205,9 +205,30 @@ func TestLoginCommandDelegation(t *testing.T) {
205205 })
206206 })
207207
208+ t .Run ("localhost registry interactive" , func (t * testing.T ) {
209+ res := c .RunDockerOrExitError ("login" , "localhost:443" )
210+ res .Assert (t , icmd.Expected {
211+ ExitCode : 1 ,
212+ Err : "Cannot perform an interactive login from a non TTY device" ,
213+ })
214+ })
215+
216+ t .Run ("localhost registry" , func (t * testing.T ) {
217+ res := c .RunDockerOrExitError ("login" , "localhost" , "-u" , "user" , "-p" , "password" )
218+ res .Assert (t , icmd.Expected {
219+ ExitCode : 1 ,
220+ Err : "http://localhost/v2/" ,
221+ })
222+ })
223+
208224 t .Run ("logout" , func (t * testing.T ) {
209225 res := c .RunDockerCmd ("logout" , "someregistry.docker.io" )
210- res .Assert (t , icmd.Expected {Out : "someregistry.docker.io" })
226+ res .Assert (t , icmd.Expected {Out : "Removing login credentials for someregistry.docker.io" })
227+ })
228+
229+ t .Run ("logout" , func (t * testing.T ) {
230+ res := c .RunDockerCmd ("logout" , "localhost:443" )
231+ res .Assert (t , icmd.Expected {Out : "Removing login credentials for localhost:443" })
211232 })
212233
213234 t .Run ("existing context" , func (t * testing.T ) {
@@ -221,18 +242,6 @@ func TestLoginCommandDelegation(t *testing.T) {
221242 })
222243}
223244
224- func TestCloudLogin (t * testing.T ) {
225- c := NewParallelE2eCLI (t , binDir )
226-
227- t .Run ("unknown backend" , func (t * testing.T ) {
228- res := c .RunDockerOrExitError ("login" , "mycloudbackend" )
229- res .Assert (t , icmd.Expected {
230- ExitCode : 1 ,
231- Err : "unknown backend type for cloud login: mycloudbackend" ,
232- })
233- })
234- }
235-
236245func TestMissingExistingCLI (t * testing.T ) {
237246 t .Parallel ()
238247 home , err := ioutil .TempDir ("" , "" )
0 commit comments