blob: 5bfa75a2eed73a16746cf05d35fc06f6d2d15d77 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe DependencyProxy::Registry, type: :model do
let(:tag) { '2.3.5-alpine' }
let(:blob_sha) { '40bd001563085fc35165329ea1ff5c5ecbdbbeef' }
context 'image name without namespace' do
let(:image) { 'ruby' }
describe '#auth_url' do
it 'returns a correct auth url' do
expect(described_class.auth_url(image))
.to eq('https://auth.docker.io/token?service=registry.docker.io&scope=repository:library/ruby:pull')
end
end
describe '#manifest_url' do
it 'returns a correct manifest url' do
expect(described_class.manifest_url(image, tag))
.to eq('https://registry-1.docker.io/v2/library/ruby/manifests/2.3.5-alpine')
end
end
describe '#blob_url' do
it 'returns a correct blob url' do
expect(described_class.blob_url(image, blob_sha))
.to eq('https://registry-1.docker.io/v2/library/ruby/blobs/40bd001563085fc35165329ea1ff5c5ecbdbbeef')
end
end
end
context 'image name with namespace' do
let(:image) { 'foo/ruby' }
describe '#auth_url' do
it 'returns a correct auth url' do
expect(described_class.auth_url(image))
.to eq('https://auth.docker.io/token?service=registry.docker.io&scope=repository:foo/ruby:pull')
end
end
describe '#manifest_url' do
it 'returns a correct manifest url' do
expect(described_class.manifest_url(image, tag))
.to eq('https://registry-1.docker.io/v2/foo/ruby/manifests/2.3.5-alpine')
end
end
describe '#blob_url' do
it 'returns a correct blob url' do
expect(described_class.blob_url(image, blob_sha))
.to eq('https://registry-1.docker.io/v2/foo/ruby/blobs/40bd001563085fc35165329ea1ff5c5ecbdbbeef')
end
end
end
end
|