Skip to content
Snippets Groups Projects
Commit 4726ff9d authored by Grzegorz Bizon's avatar Grzegorz Bizon
Browse files

Add test example for invalid registry access request

parent 60cdd2bc
No related branches found
No related tags found
1 merge request!10109Multi-level container registry images
Pipeline #
Loading
@@ -64,8 +64,6 @@ module Auth
Loading
@@ -64,8 +64,6 @@ module Auth
end end
   
def process_repository_access(type, path, actions) def process_repository_access(type, path, actions)
# TODO, add specs for invalid paths
#
return unless path.valid? return unless path.valid?
   
requested_project = path.repository_project requested_project = path.repository_project
Loading
Loading
Loading
@@ -81,13 +81,13 @@ describe Auth::ContainerRegistryAuthenticationService, services: true do
Loading
@@ -81,13 +81,13 @@ describe Auth::ContainerRegistryAuthenticationService, services: true do
end end
   
shared_examples 'container repository factory' do shared_examples 'container repository factory' do
it 'creates a new containe repository resource' do it 'creates a new container repository resource' do
expect { subject } expect { subject }
.to change { project.container_repositories.count }.by(1) .to change { project.container_repositories.count }.by(1)
end end
end end
   
shared_examples 'container repository factory' do shared_examples 'not a container repository factory' do
it 'does not create a new container repository resource' do it 'does not create a new container repository resource' do
expect { subject }.not_to change { ContainerRepository.count } expect { subject }.not_to change { ContainerRepository.count }
end end
Loading
@@ -183,6 +183,15 @@ describe Auth::ContainerRegistryAuthenticationService, services: true do
Loading
@@ -183,6 +183,15 @@ describe Auth::ContainerRegistryAuthenticationService, services: true do
it_behaves_like 'an inaccessible' it_behaves_like 'an inaccessible'
it_behaves_like 'not a container repository factory' it_behaves_like 'not a container repository factory'
end end
context 'when repository name is invalid' do
let(:current_params) do
{ scope: 'repository:invalid:push' }
end
it_behaves_like 'an inaccessible'
it_behaves_like 'not a container repository factory'
end
end end
   
context 'for internal project' do context 'for internal project' do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment