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
Tatuya Kamada
gitlab-ce
Commits
04933fd5
Commit
04933fd5
authored
May 16, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use container registry config stub
parent
8572a6b2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
34 deletions
+6
-34
spec/features/container_registry_spec.rb
spec/features/container_registry_spec.rb
+1
-6
spec/models/project_spec.rb
spec/models/project_spec.rb
+3
-13
spec/services/auth/container_registry_authentication_service_spec.rb
...es/auth/container_registry_authentication_service_spec.rb
+1
-8
spec/services/projects/destroy_service_spec.rb
spec/services/projects/destroy_service_spec.rb
+1
-7
No files found.
spec/features/container_registry_spec.rb
View file @
04933fd5
...
@@ -5,17 +5,12 @@ describe "Container Registry" do
...
@@ -5,17 +5,12 @@ describe "Container Registry" do
let
(
:repository
)
{
project
.
container_registry_repository
}
let
(
:repository
)
{
project
.
container_registry_repository
}
let
(
:tag_name
)
{
'latest'
}
let
(
:tag_name
)
{
'latest'
}
let
(
:tags
)
{
[
tag_name
]
}
let
(
:tags
)
{
[
tag_name
]
}
let
(
:registry_settings
)
do
{
enabled:
true
}
end
before
do
before
do
login_as
(
:user
)
login_as
(
:user
)
project
.
team
<<
[
@user
,
:developer
]
project
.
team
<<
[
@user
,
:developer
]
stub_container_registry_tags
(
*
tags
)
stub_container_registry_tags
(
*
tags
)
allow
(
Gitlab
.
config
.
registry
).
to
receive_messages
(
registry_settings
)
stub_container_registry_config
(
enabled:
true
)
allow
(
Auth
::
ContainerRegistryAuthenticationService
).
to
receive
(
:full_access_token
).
and_return
(
'token'
)
allow
(
Auth
::
ContainerRegistryAuthenticationService
).
to
receive
(
:full_access_token
).
and_return
(
'token'
)
end
end
...
...
spec/models/project_spec.rb
View file @
04933fd5
...
@@ -797,7 +797,7 @@ describe Project, models: true do
...
@@ -797,7 +797,7 @@ describe Project, models: true do
subject
{
project
.
container_registry_repository_url
}
subject
{
project
.
container_registry_repository_url
}
before
{
allow
(
Gitlab
.
config
.
registry
).
to
receive_messages
(
registry_settings
)
}
before
{
stub_container_registry_config
(
**
registry_settings
)
}
context
'for enabled registry'
do
context
'for enabled registry'
do
let
(
:registry_settings
)
do
let
(
:registry_settings
)
do
...
@@ -826,14 +826,8 @@ describe Project, models: true do
...
@@ -826,14 +826,8 @@ describe Project, models: true do
subject
{
project
.
has_container_registry_tags?
}
subject
{
project
.
has_container_registry_tags?
}
before
{
allow
(
Gitlab
.
config
.
registry
).
to
receive_messages
(
registry_settings
)
}
context
'for enabled registry'
do
context
'for enabled registry'
do
let
(
:registry_settings
)
do
before
{
stub_container_registry_config
(
enabled:
true
)
}
{
enabled:
true
}
end
context
'with tags'
do
context
'with tags'
do
before
{
stub_container_registry_tags
(
'test'
,
'test2'
)
}
before
{
stub_container_registry_tags
(
'test'
,
'test2'
)
}
...
@@ -849,11 +843,7 @@ describe Project, models: true do
...
@@ -849,11 +843,7 @@ describe Project, models: true do
end
end
context
'for disabled registry'
do
context
'for disabled registry'
do
let
(
:registry_settings
)
do
before
{
stub_container_registry_config
(
enabled:
false
)
}
{
enabled:
false
}
end
it
{
is_expected
.
to
be_falsey
}
it
{
is_expected
.
to
be_falsey
}
end
end
...
...
spec/services/auth/container_registry_authentication_service_spec.rb
View file @
04933fd5
...
@@ -5,19 +5,12 @@ describe Auth::ContainerRegistryAuthenticationService, services: true do
...
@@ -5,19 +5,12 @@ describe Auth::ContainerRegistryAuthenticationService, services: true do
let
(
:current_user
)
{
nil
}
let
(
:current_user
)
{
nil
}
let
(
:current_params
)
{
{}
}
let
(
:current_params
)
{
{}
}
let
(
:rsa_key
)
{
OpenSSL
::
PKey
::
RSA
.
generate
(
512
)
}
let
(
:rsa_key
)
{
OpenSSL
::
PKey
::
RSA
.
generate
(
512
)
}
let
(
:registry_settings
)
do
{
enabled:
true
,
issuer:
'rspec'
,
key:
nil
}
end
let
(
:payload
)
{
JWT
.
decode
(
subject
[
:token
],
rsa_key
).
first
}
let
(
:payload
)
{
JWT
.
decode
(
subject
[
:token
],
rsa_key
).
first
}
subject
{
described_class
.
new
(
current_project
,
current_user
,
current_params
).
execute
}
subject
{
described_class
.
new
(
current_project
,
current_user
,
current_params
).
execute
}
before
do
before
do
allow
(
Gitlab
.
config
.
registry
).
to
receive_messages
(
registry_settings
)
stub_container_registry_config
(
enabled:
true
,
issuer:
'rspec'
,
key:
nil
)
allow_any_instance_of
(
JSONWebToken
::
RSAToken
).
to
receive
(
:key
).
and_return
(
rsa_key
)
allow_any_instance_of
(
JSONWebToken
::
RSAToken
).
to
receive
(
:key
).
and_return
(
rsa_key
)
end
end
...
...
spec/services/projects/destroy_service_spec.rb
View file @
04933fd5
...
@@ -29,14 +29,8 @@ describe Projects::DestroyService, services: true do
...
@@ -29,14 +29,8 @@ describe Projects::DestroyService, services: true do
end
end
context
'container registry'
do
context
'container registry'
do
let
(
:registry_settings
)
do
{
enabled:
true
}
end
before
do
before
do
allow
(
Gitlab
.
config
.
registry
).
to
receive_messages
(
registry_settings
)
stub_container_registry_config
(
enabled:
true
)
stub_container_registry_tags
(
'tag'
)
stub_container_registry_tags
(
'tag'
)
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