Skip to content

Commit

Permalink
Merge pull request #3 from kolsean/fix-registry-create
Browse files Browse the repository at this point in the history
Fix registry creation method
  • Loading branch information
kolsean authored May 11, 2023
2 parents 43775c4 + 9de69db commit 2517c3e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
.DS_Store
*.iml
coverage.out
main.go
2 changes: 1 addition & 1 deletion pkg/v1/registry/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func Create(ctx context.Context, client *v1.ServiceClient, name string) (*Regist
return nil, nil, ErrRegistryNameEmpty
}

requestBody, err := json.Marshal(name)
requestBody, err := json.Marshal(CreateOpts{Name: name})
if err != nil {
return nil, nil, err
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/v1/registry/testing/fixtures.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import (

const testRegistryID = "9f3b5b5e-1b5a-4b5c-9b5a-5b5c1b5a4b5c"

const testCreateRegistryRequestRaw = `{
"name": "test-registry"
}`

const testCreateRegistryResponseRaw = `{
"id": "9f3b5b5e-1b5a-4b5c-9b5a-5b5c1b5a4b5c",
"name": "test-registry",
Expand Down
3 changes: 2 additions & 1 deletion pkg/v1/registry/testing/requests_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ func TestCreate(t *testing.T) {
testEnv := testutils.SetupTestEnv()
defer testEnv.TearDownTestEnv()

testutils.HandleReqWithoutBody(t, &testutils.HandleReqOpts{
testutils.HandleReqWithBody(t, &testutils.HandleReqOpts{
Mux: testEnv.Mux,
URL: "/api/v1/registries",
RawResponse: testCreateRegistryResponseRaw,
RawRequest: testCreateRegistryRequestRaw,
Method: http.MethodPost,
Status: http.StatusCreated,
CallFlag: &endpointCalled,
Expand Down

0 comments on commit 2517c3e

Please sign in to comment.