Skip to content

Commit

Permalink
for groups on org collections
Browse files Browse the repository at this point in the history
  • Loading branch information
maxlaverse committed Sep 29, 2024
1 parent d6497b8 commit 3622772
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/bitwarden/bwcli/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ func DisableRetryBackoff() Options {
}

func (c *client) CreateObject(ctx context.Context, obj models.Object) (*models.Object, error) {
obj.Groups = []interface{}{}
objEncoded, err := c.encode(obj)
if err != nil {
return nil, err
Expand All @@ -97,7 +98,6 @@ func (c *client) CreateObject(ctx context.Context, obj models.Object) (*models.O

if obj.Object == models.ObjectTypeOrgCollection {
args = append(args, "--organizationid", obj.OrganizationID)
obj.Groups = []interface{}{}
}

out, err := c.cmdWithSession(args...).Run(ctx)
Expand Down
4 changes: 2 additions & 2 deletions internal/bitwarden/bwcli/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestListObjects(t *testing.T) {
defer removeMocks(t)

b := NewClient("dummy")
_, err := b.ListObjects(context.Background(), "item", bitwarden.WithFolderID("folder-id"), bitwarden.WithCollectionID("collection-id"), bitwarden.WithSearch("search"))
_, err := b.ListObjects(context.Background(), models.ObjectTypeItem, bitwarden.WithFolderID("folder-id"), bitwarden.WithCollectionID("collection-id"), bitwarden.WithSearch("search"))

assert.NoError(t, err)
if assert.Len(t, commandsExecuted(), 1) {
Expand Down Expand Up @@ -87,7 +87,7 @@ func TestErrorContainsCommand(t *testing.T) {
defer removeMocks(t)

b := NewClient("dummy")
_, err := b.ListObjects(context.Background(), "org-collection", bitwarden.WithSearch("search"))
_, err := b.ListObjects(context.Background(), models.ObjectTypeOrgCollection, bitwarden.WithSearch("search"))

if assert.Error(t, err) {
assert.ErrorContains(t, err, "unable to parse result of 'list org-collections', error: 'unexpected end of JSON input', output: ''")
Expand Down

0 comments on commit 3622772

Please sign in to comment.