File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed
Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -143,7 +143,7 @@ func statusRun(opts *StatusOptions) error {
143143
144144 if ! isHostnameFound {
145145 fmt .Fprintf (stderr ,
146- "You are not logged into any GitHub hosts. Run %s to authenticate. \n " , cs . Bold ( fmt . Sprintf ( "gh auth login -h %s" , opts .Hostname )) )
146+ "Hostname %q not found among authenticated GitHub hosts\n " , opts .Hostname )
147147 return cmdutil .SilentError
148148 }
149149
Original file line number Diff line number Diff line change @@ -190,6 +190,17 @@ func Test_statusRun(t *testing.T) {
190190 httpmock .StringResponse (`{"data":{"viewer":{"login":"tess"}}}` ))
191191 },
192192 wantErrOut : regexp .MustCompile (`(?s)Token: xyz456.*Token: abc123` ),
193+ }, {
194+ name : "missing hostname" ,
195+ opts : & StatusOptions {
196+ Hostname : "github.example.com" ,
197+ },
198+ cfg : func (c config.Config ) {
199+ _ = c .Set ("github.com" , "oauth_token" , "abc123" )
200+ },
201+ httpStubs : func (reg * httpmock.Registry ) {},
202+ wantErrOut : regexp .MustCompile (`(?s)Hostname "github.example.com" not found among authenticated GitHub hosts` ),
203+ wantErr : regexp .MustCompile (`` ),
193204 },
194205 }
195206
@@ -241,9 +252,9 @@ func Test_statusRun(t *testing.T) {
241252 if tt .wantErr != nil {
242253 assert .True (t , tt .wantErr .MatchString (err .Error ()))
243254 return
244- } else {
245- t .Fatalf ("unexpected error: %s" , err )
246255 }
256+
257+ t .Fatalf ("unexpected error: %s" , err )
247258 }
248259
249260 if tt .wantErrOut == nil {
You can’t perform that action at this time.
0 commit comments