summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2018-06-21 22:38:58 +0800
committerLin Jen-Shin <godfat@godfat.org>2018-06-21 22:38:58 +0800
commitc519cac2cbae91096e2b1a9a3c9f1bf02df0c1e4 (patch)
treeae56e14bbf9ac76da759cbf2bc48c0528e48b4aa
parent94ac31e28b5de11b86a60e8dd56c472c777234a4 (diff)
downloadgitlab-ce-unify-container_registry_authentication_service_spec.rb.tar.gz
-rw-r--r--spec/services/auth/container_registry_authentication_service_spec.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/services/auth/container_registry_authentication_service_spec.rb b/spec/services/auth/container_registry_authentication_service_spec.rb
index da8e660c16b..fce73e0ac1f 100644
--- a/spec/services/auth/container_registry_authentication_service_spec.rb
+++ b/spec/services/auth/container_registry_authentication_service_spec.rb
@@ -21,6 +21,11 @@ describe Auth::ContainerRegistryAuthenticationService do
allow_any_instance_of(JSONWebToken::RSAToken).to receive(:key).and_return(rsa_key)
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
it { is_expected.to include(:token) }
it { expect(payload).to include('access') }
@@ -380,6 +385,14 @@ describe Auth::ContainerRegistryAuthenticationService do
current_project.add_developer(current_user)
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'
context 'allow to pull and push images' do