Loading container_registry.go +3 Changes for container_registry.go: 3 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -106,6 +106,8 @@ type RegistryRepository struct { Status *ContainerRegistryStatus `json:"status"` TagsCount int64 `json:"tags_count"` Tags []*RegistryRepositoryTag `json:"tags"` DeleteAPIPath string `json:"delete_api_path"` Size int64 `json:"size"` } func (s RegistryRepository) String() string { Loading Loading @@ -177,6 +179,7 @@ func (s *ContainerRegistryService) ListGroupRegistryRepositories(gid any, opt *L type GetSingleRegistryRepositoryOptions struct { Tags *bool `url:"tags,omitempty" json:"tags,omitempty"` TagsCount *bool `url:"tags_count,omitempty" json:"tags_count,omitempty"` Size *bool `url:"size,omitempty" json:"size,omitempty"` } func (s *ContainerRegistryService) GetSingleRegistryRepository(pid any, opt *GetSingleRegistryRepositoryOptions, options ...RequestOptionFunc) (*RegistryRepository, *Response, error) { Loading container_registry_test.go +29 Changes for container_registry_test.go: 29 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -165,6 +165,35 @@ func TestGetSingleRegistryRepository(t *testing.T) { assert.Equal(t, want, repository) } func TestGetSingleRegistryRepository_sizeAndDeleteAPIPath(t *testing.T) { t.Parallel() mux, client := setup(t) mux.HandleFunc("/api/v4/registry/repositories/5", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, http.MethodGet) testParam(t, r, "size", "true") mustWriteJSONResponse(t, w, map[string]any{ "id": 1, "path": "group/project", "project_id": 9, "size": 12345, "delete_api_path": "https://gitlab.example.com/api/v4/projects/9/registry/repositories/1", }) }) // GIVEN size=true opt := &GetSingleRegistryRepositoryOptions{Size: new(true)} // WHEN getting the repository repository, resp, err := client.ContainerRegistry.GetSingleRegistryRepository(5, opt) // THEN size and delete_api_path are decoded require.NoError(t, err) require.NotNil(t, resp) assert.Equal(t, int64(12345), repository.Size) assert.Equal(t, "https://gitlab.example.com/api/v4/projects/9/registry/repositories/1", repository.DeleteAPIPath) } func TestDeleteRegistryRepository(t *testing.T) { t.Parallel() mux, client := setup(t) Loading Loading
container_registry.go +3 Changes for container_registry.go: 3 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -106,6 +106,8 @@ type RegistryRepository struct { Status *ContainerRegistryStatus `json:"status"` TagsCount int64 `json:"tags_count"` Tags []*RegistryRepositoryTag `json:"tags"` DeleteAPIPath string `json:"delete_api_path"` Size int64 `json:"size"` } func (s RegistryRepository) String() string { Loading Loading @@ -177,6 +179,7 @@ func (s *ContainerRegistryService) ListGroupRegistryRepositories(gid any, opt *L type GetSingleRegistryRepositoryOptions struct { Tags *bool `url:"tags,omitempty" json:"tags,omitempty"` TagsCount *bool `url:"tags_count,omitempty" json:"tags_count,omitempty"` Size *bool `url:"size,omitempty" json:"size,omitempty"` } func (s *ContainerRegistryService) GetSingleRegistryRepository(pid any, opt *GetSingleRegistryRepositoryOptions, options ...RequestOptionFunc) (*RegistryRepository, *Response, error) { Loading
container_registry_test.go +29 Changes for container_registry_test.go: 29 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -165,6 +165,35 @@ func TestGetSingleRegistryRepository(t *testing.T) { assert.Equal(t, want, repository) } func TestGetSingleRegistryRepository_sizeAndDeleteAPIPath(t *testing.T) { t.Parallel() mux, client := setup(t) mux.HandleFunc("/api/v4/registry/repositories/5", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, http.MethodGet) testParam(t, r, "size", "true") mustWriteJSONResponse(t, w, map[string]any{ "id": 1, "path": "group/project", "project_id": 9, "size": 12345, "delete_api_path": "https://gitlab.example.com/api/v4/projects/9/registry/repositories/1", }) }) // GIVEN size=true opt := &GetSingleRegistryRepositoryOptions{Size: new(true)} // WHEN getting the repository repository, resp, err := client.ContainerRegistry.GetSingleRegistryRepository(5, opt) // THEN size and delete_api_path are decoded require.NoError(t, err) require.NotNil(t, resp) assert.Equal(t, int64(12345), repository.Size) assert.Equal(t, "https://gitlab.example.com/api/v4/projects/9/registry/repositories/1", repository.DeleteAPIPath) } func TestDeleteRegistryRepository(t *testing.T) { t.Parallel() mux, client := setup(t) Loading