-
Notifications
You must be signed in to change notification settings - Fork 1
/
registry_test.go
57 lines (52 loc) · 1.4 KB
/
registry_test.go
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
package hop
import (
"testing"
"go.hop.io/sdk/types"
)
func TestClient_Registry_GetAll(t *testing.T) {
c := &mockClientDoer{
t: t,
wantMethod: "GET",
wantPath: "/registry/images",
wantClientOpts: []ClientOption{WithProjectID("test123")},
wantResultKey: "images",
wantIgnore404: false,
tokenType: "pat",
}
testApiSingleton(c,
&ClientCategoryRegistryImages{c: c},
"GetAll",
[]any{WithProjectID("test123")},
[]*types.Image{{Name: "hello"}})
}
func TestClient_Registry_GetManifest(t *testing.T) {
c := &mockClientDoer{
t: t,
wantMethod: "GET",
wantPath: "/registry/images/test%20test/manifests",
wantClientOpts: []ClientOption{WithProjectID("test123")},
wantResultKey: "manifest",
wantIgnore404: false,
tokenType: "pat",
}
testApiSingleton(c,
&ClientCategoryRegistryImages{c: c},
"GetManifest",
[]any{"test test", WithProjectID("test123")},
[]*types.ImageManifest{{Tag: types.StringPointerify("hello")}})
}
func TestClient_Registry_Delete(t *testing.T) {
c := &mockClientDoer{
t: t,
wantMethod: "DELETE",
wantPath: "/registry/images/test%20test",
wantClientOpts: []ClientOption{WithProjectID("test123")},
wantIgnore404: false,
tokenType: "pat",
}
testApiSingleton(c,
&ClientCategoryRegistryImages{c: c},
"Delete",
[]any{"test test", WithProjectID("test123")},
nil)
}