Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dex
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hdacloud
dex
Commits
943e23cd
Unverified
Commit
943e23cd
authored
7 years ago
by
rithu leena john
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #1109 from ericchiang/oidc-test
connector/oidc: remove test that talks to the internet
parents
e3b96243
6475ce1f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
connector/oidc/oidc_test.go
+0
-98
0 additions, 98 deletions
connector/oidc/oidc_test.go
with
0 additions
and
98 deletions
connector/oidc/oidc_test.go
+
0
−
98
View file @
943e23cd
package
oidc
package
oidc
import
(
import
(
"net/url"
"os"
"reflect"
"testing"
"testing"
"github.com/coreos/dex/connector"
"github.com/sirupsen/logrus"
)
)
func
TestKnownBrokenAuthHeaderProvider
(
t
*
testing
.
T
)
{
func
TestKnownBrokenAuthHeaderProvider
(
t
*
testing
.
T
)
{
...
@@ -29,95 +23,3 @@ func TestKnownBrokenAuthHeaderProvider(t *testing.T) {
...
@@ -29,95 +23,3 @@ func TestKnownBrokenAuthHeaderProvider(t *testing.T) {
}
}
}
}
}
}
func
TestOidcConnector_LoginURL
(
t
*
testing
.
T
)
{
logger
:=
&
logrus
.
Logger
{
Out
:
os
.
Stderr
,
Formatter
:
&
logrus
.
TextFormatter
{
DisableColors
:
true
},
Level
:
logrus
.
DebugLevel
,
}
tests
:=
[]
struct
{
scopes
connector
.
Scopes
hostedDomains
[]
string
wantScopes
string
wantHdParam
string
}{
{
connector
.
Scopes
{},
[]
string
{
"example.com"
},
"openid profile email"
,
"example.com"
,
},
{
connector
.
Scopes
{},
[]
string
{
"mydomain.org"
,
"example.com"
},
"openid profile email"
,
"*"
,
},
{
connector
.
Scopes
{},
[]
string
{},
"openid profile email"
,
""
,
},
{
connector
.
Scopes
{
OfflineAccess
:
true
},
[]
string
{},
"openid profile email"
,
""
,
},
}
callback
:=
"https://dex.example.com/callback"
state
:=
"secret"
for
_
,
test
:=
range
tests
{
config
:=
&
Config
{
Issuer
:
"https://accounts.google.com"
,
ClientID
:
"client-id"
,
ClientSecret
:
"client-secret"
,
RedirectURI
:
"https://dex.example.com/callback"
,
HostedDomains
:
test
.
hostedDomains
,
}
conn
,
err
:=
config
.
Open
(
"oidc"
,
logger
)
if
err
!=
nil
{
t
.
Errorf
(
"failed to open connector: %v"
,
err
)
continue
}
loginURL
,
err
:=
conn
.
(
connector
.
CallbackConnector
)
.
LoginURL
(
test
.
scopes
,
callback
,
state
)
if
err
!=
nil
{
t
.
Errorf
(
"failed to get login URL: %v"
,
err
)
continue
}
actual
,
err
:=
url
.
Parse
(
loginURL
)
if
err
!=
nil
{
t
.
Errorf
(
"failed to parse login URL: %v"
,
err
)
continue
}
wanted
,
_
:=
url
.
Parse
(
"https://accounts.google.com/o/oauth2/v2/auth"
)
wantedQuery
:=
&
url
.
Values
{}
wantedQuery
.
Set
(
"client_id"
,
config
.
ClientID
)
wantedQuery
.
Set
(
"redirect_uri"
,
config
.
RedirectURI
)
wantedQuery
.
Set
(
"response_type"
,
"code"
)
wantedQuery
.
Set
(
"state"
,
"secret"
)
wantedQuery
.
Set
(
"scope"
,
test
.
wantScopes
)
if
test
.
wantHdParam
!=
""
{
wantedQuery
.
Set
(
"hd"
,
test
.
wantHdParam
)
}
wanted
.
RawQuery
=
wantedQuery
.
Encode
()
if
!
reflect
.
DeepEqual
(
actual
,
wanted
)
{
t
.
Errorf
(
"Wanted %v, got %v"
,
wanted
,
actual
)
}
}
}
//func TestOidcConnector_HandleCallback(t *testing.T) {
// logger := &logrus.Logger{
// Out: os.Stderr,
// Formatter: &logrus.TextFormatter{DisableColors: true},
// Level: logrus.DebugLevel,
// }
//
// tests := []struct {
//
// }
//}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment