Commit 5bcf5de2 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Merge branch 'unify-container_registry_authentication_service_spec.rb' into 'master'

Unify spec/services/auth/container_registry_authentication_service_spec.rb

See merge request gitlab-org/gitlab-ce!20071
parents 0ea5d664 c519cac2
...@@ -21,6 +21,11 @@ describe Auth::ContainerRegistryAuthenticationService do ...@@ -21,6 +21,11 @@ describe Auth::ContainerRegistryAuthenticationService do
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
shared_examples 'an authenticated' do
it { is_expected.to include(:token) }
it { expect(payload).to include('access') }
end
shared_examples 'a valid token' do shared_examples 'a valid token' do
it { is_expected.to include(:token) } it { is_expected.to include(:token) }
it { expect(payload).to include('access') } it { expect(payload).to include('access') }
...@@ -380,6 +385,14 @@ describe Auth::ContainerRegistryAuthenticationService do ...@@ -380,6 +385,14 @@ describe Auth::ContainerRegistryAuthenticationService do
current_project.add_developer(current_user) current_project.add_developer(current_user)
end end
context 'allow to use offline_token' do
let(:current_params) do
{ offline_token: true }
end
it_behaves_like 'an authenticated'
end
it_behaves_like 'a valid token' it_behaves_like 'a valid token'
context 'allow to pull and push images' do context 'allow to pull and push images' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment