X Tutup
Skip to content

Commit 02883a8

Browse files
author
Ryan Nystrom
authored
add tests
1 parent 93bc389 commit 02883a8

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

pkg/cmd/auth/login/login_test.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,28 @@ func Test_NewCmdLogin(t *testing.T) {
118118
cli: "--web --with-token",
119119
wantsErr: true,
120120
},
121+
{
122+
name: "tty one scope",
123+
stdinTTY: true,
124+
cli: "--scopes repo:invite",
125+
wants: LoginOptions{
126+
Hostname: "",
127+
Scopes: []string{"repo:invite"},
128+
Token: "",
129+
Interactive: true,
130+
},
131+
},
132+
{
133+
name: "tty scopes",
134+
stdinTTY: true,
135+
cli: "--scopes repo:invite,read:public_key",
136+
wants: LoginOptions{
137+
Hostname: "",
138+
Scopes: []string{"repo:invite", "read:public_key"},
139+
Token: "",
140+
Interactive: true,
141+
},
142+
},
121143
}
122144

123145
for _, tt := range tests {
@@ -160,6 +182,7 @@ func Test_NewCmdLogin(t *testing.T) {
160182
assert.Equal(t, tt.wants.Hostname, gotOpts.Hostname)
161183
assert.Equal(t, tt.wants.Web, gotOpts.Web)
162184
assert.Equal(t, tt.wants.Interactive, gotOpts.Interactive)
185+
assert.Equal(t, tt.wants.Scopes, gotOpts.Scopes)
163186
})
164187
}
165188
}

0 commit comments

Comments
 (0)
X Tutup