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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
ac6992ba
Commit
ac6992ba
authored
May 16, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix specs
parent
0a6c3494
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
2 deletions
+10
-2
spec/models/project_spec.rb
spec/models/project_spec.rb
+2
-0
spec/services/auth/container_registry_authentication_service_spec.rb
...es/auth/container_registry_authentication_service_spec.rb
+7
-2
spec/support/stub_gitlab_calls.rb
spec/support/stub_gitlab_calls.rb
+1
-0
No files found.
spec/models/project_spec.rb
View file @
ac6992ba
...
@@ -787,6 +787,8 @@ describe Project, models: true do
...
@@ -787,6 +787,8 @@ describe Project, models: true do
describe
'#container_registry_repository'
do
describe
'#container_registry_repository'
do
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:project
)
{
create
(
:empty_project
)
}
before
{
stub_container_registry_config
(
enabled:
true
)
}
subject
{
project
.
container_registry_repository
}
subject
{
project
.
container_registry_repository
}
it
{
is_expected
.
to_not
be_nil
}
it
{
is_expected
.
to_not
be_nil
}
...
...
spec/services/auth/container_registry_authentication_service_spec.rb
View file @
ac6992ba
...
@@ -50,6 +50,11 @@ describe Auth::ContainerRegistryAuthenticationService, services: true do
...
@@ -50,6 +50,11 @@ describe Auth::ContainerRegistryAuthenticationService, services: true do
end
end
end
end
shared_examples
'an unauthorized'
do
it
{
is_expected
.
to
include
(
http_status:
401
)
}
it
{
is_expected
.
to_not
include
(
:token
)
}
end
shared_examples
'a forbidden'
do
shared_examples
'a forbidden'
do
it
{
is_expected
.
to
include
(
http_status:
403
)
}
it
{
is_expected
.
to
include
(
http_status:
403
)
}
it
{
is_expected
.
to_not
include
(
:token
)
}
it
{
is_expected
.
to_not
include
(
:token
)
}
...
@@ -116,7 +121,7 @@ describe Auth::ContainerRegistryAuthenticationService, services: true do
...
@@ -116,7 +121,7 @@ describe Auth::ContainerRegistryAuthenticationService, services: true do
{
offline_token:
true
}
{
offline_token:
true
}
end
end
it_behaves_like
'a
forbidden
'
it_behaves_like
'a
n unauthorized
'
end
end
context
'allow to pull and push images'
do
context
'allow to pull and push images'
do
...
@@ -179,7 +184,7 @@ describe Auth::ContainerRegistryAuthenticationService, services: true do
...
@@ -179,7 +184,7 @@ describe Auth::ContainerRegistryAuthenticationService, services: true do
{
offline_token:
true
}
{
offline_token:
true
}
end
end
it_behaves_like
'a
forbidden
'
it_behaves_like
'a
n unauthorized
'
end
end
context
'for invalid scope'
do
context
'for invalid scope'
do
...
...
spec/support/stub_gitlab_calls.rb
View file @
ac6992ba
...
@@ -27,6 +27,7 @@ module StubGitlabCalls
...
@@ -27,6 +27,7 @@ module StubGitlabCalls
def
stub_container_registry_config
(
registry_settings
)
def
stub_container_registry_config
(
registry_settings
)
allow
(
Gitlab
.
config
.
registry
).
to
receive_messages
(
registry_settings
)
allow
(
Gitlab
.
config
.
registry
).
to
receive_messages
(
registry_settings
)
allow
(
Auth
::
ContainerRegistryAuthenticationService
).
to
receive
(
:full_access_token
).
and_return
(
'token'
)
end
end
def
stub_container_registry_tags
(
*
tags
)
def
stub_container_registry_tags
(
*
tags
)
...
...
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