Skip to content

Commit

Permalink
Added Test for DeleteRegistryRepository
Browse files Browse the repository at this point in the history
  • Loading branch information
Urento committed Aug 28, 2021
1 parent 27ac6ee commit 393cff0
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions container_registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,22 +61,22 @@ func TestListRegistryRepositories(t *testing.T) {

created_at1, err := time.Parse(timeLayout, "2019-01-10T13:38:57.391Z")
if err != nil {
t.Errorf("error while parsing time: %v", err)
t.Errorf("ContainerRepository.ListRegistryRepositories error while parsing time: %v", err)
}

created_at2, err := time.Parse(timeLayout, "2019-01-10T13:39:08.229Z")
if err != nil {
t.Errorf("error while parsing time: %v", err)
t.Errorf("ContainerRepository.ListRegistryRepositories error while parsing time: %v", err)
}

cleanup_policy_started_at1, err := time.Parse(timeLayout, "2020-01-10T15:40:57.391Z")
if err != nil {
t.Errorf("error while parsing time: %v", err)
t.Errorf("ContainerRepository.ListRegistryRepositories error while parsing time: %v", err)
}

cleanup_policy_started_at2, err := time.Parse(timeLayout, "2020-08-17T03:12:35.489Z")
if err != nil {
t.Errorf("error while parsing time: %v", err)
t.Errorf("ContainerRepository.ListRegistryRepositories error while parsing time: %v", err)
}

want := []*RegistryRepository{
Expand All @@ -87,3 +87,17 @@ func TestListRegistryRepositories(t *testing.T) {
t.Errorf("ContainerRepository.ListRegistryRepositories returned %+v, want %+v", repositories, want)
}
}

func TestDeleteRegistryRepository(t *testing.T) {
mux, server, client := setup(t)
defer teardown(server)

mux.HandleFunc("/api/v4/projects/5/registry/repositories/2", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, http.MethodDelete)
})

_, err := client.ContainerRegistry.DeleteRegistryRepository(5, 2)
if err != nil {
t.Errorf("ContainerRegistry.DeleteRegistryRepository returned error: %v", err)
}
}

0 comments on commit 393cff0

Please sign in to comment.