It("authenticates successfully", func() { reqFactory.ApiEndpointSuccess = true context := testcmd.NewContext("auth", []string{"*****@*****.**", "password"}) testcmd.RunCommand(cmd, context, reqFactory) Expect(ui.FailedWithUsage).To(BeFalse()) testassert.SliceContains(ui.Outputs, testassert.Lines{ {"foo.example.org/authenticate"}, {"OK"}, }) Expect(repo.Email).To(Equal("*****@*****.**")) Expect(repo.Password).To(Equal("password")) }) It("TestUnsuccessfullyAuthenticatingWithoutInteractivity", func() { repo.AuthError = true context := testcmd.NewContext("auth", []string{"username", "password"}) testcmd.RunCommand(cmd, context, reqFactory) println(ui.DumpOutputs()) testassert.SliceContains(ui.Outputs, testassert.Lines{ {config.ApiEndpoint()}, {"Authenticating..."}, {"FAILED"}, {"Error authenticating"}, }) }) }) })