Skip to content

Commit

Permalink
Add oauth scopes tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jceresini committed Jul 9, 2020
1 parent adc20c3 commit 82746dc
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions disco/host_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,18 @@ func TestHostServiceOAuthClient(t *testing.T) {
"authz": "/foo",
"token": "***not A URL at all!:/<@@@@>***",
},
"scopesincluded.v1": map[string]interface{}{
"client": "scopesincluded",
"authz": "/auth",
"token": "/token",
"scopes": []interface{}{"app1.full_access", "app2.read_only"},
},
"scopesempty.v1": map[string]interface{}{
"client": "scopesempty",
"authz": "/auth",
"token": "/token",
"scopes": []interface{}{},
},
},
}

Expand Down Expand Up @@ -290,6 +302,31 @@ func TestHostServiceOAuthClient(t *testing.T) {
nil,
"Failed to parse token URL: parse ***not A URL at all!:/<@@@@>***: first path segment in URL cannot contain colon",
},
{
"scopesincluded.v1",
&OAuthClient{
ID: "scopesincluded",
AuthorizationURL: mustURL(t, "https://example.com/auth"),
TokenURL: mustURL(t, "https://example.com/token"),
MinPort: 1024,
MaxPort: 65535,
SupportedGrantTypes: NewOAuthGrantTypeSet("authz_code"),
Scopes: []string{"app1.full_access", "app2.read_only"},
},
"",
},
{
"scopesempty.v1",
&OAuthClient{
ID: "scopesempty",
AuthorizationURL: mustURL(t, "https://example.com/auth"),
TokenURL: mustURL(t, "https://example.com/token"),
MinPort: 1024,
MaxPort: 65535,
SupportedGrantTypes: NewOAuthGrantTypeSet("authz_code"),
},
"",
},
}

for _, test := range tests {
Expand Down

0 comments on commit 82746dc

Please sign in to comment.