Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
f40ce034
Commit
f40ce034
authored
Mar 05, 2019
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add SCIM specs
parent
1b350d99
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
144 additions
and
0 deletions
+144
-0
ee/spec/controllers/groups/saml_providers_controller_spec.rb
ee/spec/controllers/groups/saml_providers_controller_spec.rb
+17
-0
ee/spec/controllers/groups/scim_oauth_controller_spec.rb
ee/spec/controllers/groups/scim_oauth_controller_spec.rb
+110
-0
ee/spec/serializers/scim_oauth_access_token_entity_spec.rb
ee/spec/serializers/scim_oauth_access_token_entity_spec.rb
+17
-0
No files found.
ee/spec/controllers/groups/saml_providers_controller_spec.rb
View file @
f40ce034
...
@@ -79,6 +79,23 @@ describe Groups::SamlProvidersController do
...
@@ -79,6 +79,23 @@ describe Groups::SamlProvidersController do
expect
(
response
).
to
render_template
'groups/saml_providers/show'
expect
(
response
).
to
render_template
'groups/saml_providers/show'
end
end
it
'has the SCIM token URL'
do
group
.
add_owner
(
user
)
subject
expect
(
assigns
(
:scim_token_url
)).
to
eq
(
'http://test.host/groups/group1/-/scim_oauth'
)
end
it
'sets scim_token_exists if SCIM token is found'
do
create
(
:scim_oauth_access_token
,
group:
group
)
group
.
add_owner
(
user
)
subject
expect
(
assigns
(
:scim_token_exists
)).
to
be
true
end
context
'not on a top level group'
,
:nested_groups
do
context
'not on a top level group'
,
:nested_groups
do
let
(
:group
)
{
create
(
:group
,
:nested
)
}
let
(
:group
)
{
create
(
:group
,
:nested
)
}
...
...
ee/spec/controllers/groups/scim_oauth_controller_spec.rb
0 → 100644
View file @
f40ce034
require
'spec_helper'
describe
Groups
::
ScimOauthController
do
let
(
:saml_provider
)
{
create
(
:saml_provider
,
group:
group
)
}
let
(
:group
)
{
create
(
:group
,
:private
,
parent_id:
nil
)
}
let
(
:user
)
{
create
(
:user
)
}
before
do
sign_in
(
user
)
end
def
stub_saml_config
(
enabled
:)
providers
=
enabled
?
%i(group_saml)
:
[]
allow
(
Devise
).
to
receive
(
:omniauth_providers
).
and_return
(
providers
)
end
context
'when the feature is enabled'
do
before
do
stub_saml_config
(
enabled:
true
)
stub_licensed_features
(
group_saml:
true
)
stub_feature_flags
(
group_scim:
true
)
end
describe
'GET #show'
do
subject
{
get
:show
,
params:
{
group_id:
group
},
format: :json
}
before
do
group
.
add_owner
(
user
)
end
context
'without token'
do
it
'shows an empty response'
do
subject
expect
(
json_response
).
to
eq
({})
end
end
context
'with token'
do
let!
(
:scim_token
)
{
create
(
:scim_oauth_access_token
,
group:
group
)
}
before
do
subject
end
it
'shows the token'
do
expect
(
json_response
[
'scim_token'
]).
to
eq
(
scim_token
.
token
)
end
it
'shows the url'
do
expect
(
json_response
[
'scim_api_url'
]).
not_to
be_empty
end
end
end
describe
'POST #create'
do
subject
{
post
:create
,
params:
{
group_id:
group
},
format: :json
}
before
do
group
.
add_owner
(
user
)
end
context
'without token'
do
it
'creates a new SCIM token record'
do
expect
{
subject
}.
to
change
{
ScimOauthAccessToken
.
count
}.
by
(
1
)
end
context
'json'
do
before
do
subject
end
it
'shows the token'
do
expect
(
json_response
[
'scim_token'
]).
not_to
be_empty
end
it
'shows the url'
do
expect
(
json_response
[
'scim_api_url'
]).
not_to
be_empty
end
end
end
context
'with token'
do
let!
(
:scim_token
)
{
create
(
:scim_oauth_access_token
,
group:
group
)
}
it
'does not create a new SCIM token record'
do
expect
{
subject
}.
not_to
change
{
ScimOauthAccessToken
.
count
}
end
it
'updates the token'
do
expect
{
subject
}.
to
change
{
scim_token
.
reload
.
token
}
end
context
'json'
do
before
do
subject
end
it
'shows the token'
do
expect
(
json_response
[
'scim_token'
]).
to
eq
(
scim_token
.
reload
.
token
)
end
it
'shows the url'
do
expect
(
json_response
[
'scim_api_url'
]).
not_to
be_empty
end
end
end
end
end
end
ee/spec/serializers/scim_oauth_access_token_entity_spec.rb
0 → 100644
View file @
f40ce034
require
'spec_helper'
describe
ScimOauthAccessTokenEntity
do
let
(
:entity
)
do
described_class
.
new
(
create
(
:scim_oauth_access_token
))
end
subject
{
entity
.
as_json
}
it
"exposes the URL"
do
is_expected
.
to
include
(
:scim_api_url
)
end
it
"exposes the token"
do
is_expected
.
to
include
(
:scim_token
)
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment