Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
greg
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
it-bott-integrasjoner
greg
Commits
2bb2b7f0
Commit
2bb2b7f0
authored
3 years ago
by
Sivert Kronen Hatteberg
Browse files
Options
Downloads
Patches
Plain Diff
Fix linting
parent
e4d96a07
No related branches found
No related tags found
1 merge request
!106
Add some OIDC flow tests.
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
gregsite/settings/testing.py
+2
-3
2 additions, 3 deletions
gregsite/settings/testing.py
gregui/tests/conftest.py
+5
-4
5 additions, 4 deletions
gregui/tests/conftest.py
gregui/tests/test_oidc.py
+3
-4
3 additions, 4 deletions
gregui/tests/test_oidc.py
with
10 additions
and
11 deletions
gregsite/settings/testing.py
+
2
−
3
View file @
2bb2b7f0
...
@@ -7,8 +7,8 @@ AUTHENTICATION_BACKENDS = [
...
@@ -7,8 +7,8 @@ AUTHENTICATION_BACKENDS = [
"
sesame.backends.ModelBackend
"
,
# link login
"
sesame.backends.ModelBackend
"
,
# link login
]
]
OIDC_RP_CLIENT_ID
=
'
lalalalala
'
OIDC_RP_CLIENT_ID
=
"
lalalalala
"
OIDC_RP_CLIENT_SECRET
=
'
lalalalala
'
OIDC_RP_CLIENT_SECRET
=
"
lalalalala
"
LOGIN_REDIRECT_URL
=
"
http://localhost:3000/
"
LOGIN_REDIRECT_URL
=
"
http://localhost:3000/
"
LOGOUT_REDIRECT_URL
=
"
http://localhost:3000/
"
LOGOUT_REDIRECT_URL
=
"
http://localhost:3000/
"
...
@@ -42,4 +42,3 @@ Q_CLUSTER = {
...
@@ -42,4 +42,3 @@ Q_CLUSTER = {
"
orm
"
:
"
default
"
,
"
orm
"
:
"
default
"
,
"
sync
"
:
True
,
"
sync
"
:
True
,
}
}
This diff is collapsed.
Click to expand it.
gregui/tests/conftest.py
+
5
−
4
View file @
2bb2b7f0
...
@@ -56,6 +56,7 @@ def id_token_payload():
...
@@ -56,6 +56,7 @@ def id_token_payload():
"
nonce
"
:
"
noncenonce
"
,
"
nonce
"
:
"
noncenonce
"
,
}
}
@pytest.fixture
@pytest.fixture
def
data
():
def
data
():
return
{
return
{
...
@@ -76,7 +77,7 @@ def data():
...
@@ -76,7 +77,7 @@ def data():
"
person1
"
:
{
"
person1
"
:
{
"
type
"
:
"
feide_id
"
,
"
type
"
:
"
feide_id
"
,
"
value
"
:
"
foo@example.com
"
,
"
value
"
:
"
foo@example.com
"
,
"
person
"
:
{
"
email
"
:
"
foo@example.com
"
}
"
person
"
:
{
"
email
"
:
"
foo@example.com
"
}
,
},
},
},
},
"
Person
"
:
{
"
Person
"
:
{
...
@@ -84,7 +85,7 @@ def data():
...
@@ -84,7 +85,7 @@ def data():
"
first_name
"
:
"
Foo
"
,
"
first_name
"
:
"
Foo
"
,
"
last_name
"
:
"
Baresen
"
,
"
last_name
"
:
"
Baresen
"
,
"
email
"
:
"
foo@example.com
"
,
"
email
"
:
"
foo@example.com
"
,
},
},
},
},
"
Sponsor
"
:
{
"
Sponsor
"
:
{
"
sponsor1
"
:
{
"
sponsor1
"
:
{
...
@@ -101,10 +102,10 @@ def save_object(model, **kwargs):
...
@@ -101,10 +102,10 @@ def save_object(model, **kwargs):
obj
.
save
()
obj
.
save
()
return
obj
return
obj
# TODO add person and sponsor
# TODO add person and sponsor
OBJECT_MAPPING
=
{
OBJECT_MAPPING
=
{
"
greg
"
"
greg
"
"
person
"
:
Person
,
"
person
"
:
Person
,
"
sponsor
"
:
Sponsor
,
"
sponsor
"
:
Sponsor
,
"
user
"
:
get_user_model
(),
"
user
"
:
get_user_model
(),
}
}
...
...
This diff is collapsed.
Click to expand it.
gregui/tests/test_oidc.py
+
3
−
4
View file @
2bb2b7f0
...
@@ -2,9 +2,8 @@ import time
...
@@ -2,9 +2,8 @@ import time
import
pytest
import
pytest
from
django.core.exceptions
import
SuspiciousOperation
from
django.core.exceptions
import
SuspiciousOperation
from
django.conf
import
settings
from
greg.models
import
Identity
,
Person
,
Sponsor
from
greg.models
import
Identity
from
gregui.authentication.auth_backends
import
GregOIDCBackend
from
gregui.authentication.auth_backends
import
GregOIDCBackend
from
gregui.models
import
GregUserProfile
from
gregui.models
import
GregUserProfile
...
@@ -63,8 +62,8 @@ def test_create_user(claims):
...
@@ -63,8 +62,8 @@ def test_create_user(claims):
assert
person
.
last_name
==
user
.
last_name
assert
person
.
last_name
==
user
.
last_name
assert
person
.
email
==
user
.
email
assert
person
.
email
==
user
.
email
ids
=
Identity
.
objects
.
get
(
person
=
person
,
type
=
'
feide_id
'
)
ids
=
Identity
.
objects
.
get
(
person
=
person
,
type
=
"
feide_id
"
)
assert
ids
.
value
==
'
frank_foreleser@spusers.feide.no
'
assert
ids
.
value
==
"
frank_foreleser@spusers.feide.no
"
def
test_update_user
(
greg_users
,
claims
):
def
test_update_user
(
greg_users
,
claims
):
...
...
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