Bring changes from EE

This commit is contained in:
Lin Jen-Shin 2018-06-21 22:38:58 +08:00
parent 94ac31e28b
commit c519cac2cb
1 changed files with 13 additions and 0 deletions

View File

@ -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