Skip to content

Commit

Permalink
try to fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
maxlaverse committed Sep 29, 2024
1 parent 83b5ac5 commit 3cf8563
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions internal/bitwarden/bwcli/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ func (c *client) Logout(ctx context.Context) error {
}

func (c *client) DeleteObject(ctx context.Context, obj models.Object) error {
// TODO: Don't fail if object is already gone
args := []string{
"delete",
string(obj.Object),
Expand All @@ -262,6 +263,7 @@ func (c *client) DeleteObject(ctx context.Context, obj models.Object) error {
}

func (c *client) DeleteAttachment(ctx context.Context, itemId, attachmentId string) error {
// TODO: Don't fail if attachment is already gone
_, err := c.cmdWithSession("delete", string(models.ObjectTypeAttachment), attachmentId, "--itemid", itemId).Run(ctx)
return err
}
Expand Down
2 changes: 2 additions & 0 deletions internal/bitwarden/embedded/vault_webapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ func (v *webAPIVault) CreateOrganization(ctx context.Context, organizationName,
}

func (v *webAPIVault) DeleteAttachment(ctx context.Context, itemId, attachmentId string) error {
// TODO: Don't fail if attachment is already gone
err := v.client.DeleteObjectAttachment(ctx, itemId, attachmentId)
if err != nil {
return fmt.Errorf("error deleting attachment: %w", err)
Expand Down Expand Up @@ -310,6 +311,7 @@ func (v *webAPIVault) DeleteAttachment(ctx context.Context, itemId, attachmentId
}

func (v *webAPIVault) DeleteObject(ctx context.Context, obj models.Object) error {
// TODO: Don't fail if object is already gone
var err error
if obj.Object == models.ObjectTypeFolder {
err = v.client.DeleteFolder(ctx, obj.ID)
Expand Down
3 changes: 3 additions & 0 deletions internal/provider/resource_attachment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ func TestAccMissingAttachmentIsRecreated(t *testing.T) {
PlanOnly: true,
ExpectNonEmptyPlan: true,
},
{
Config: tfConfigProvider() + tfConfigResourceAttachment("fixtures/attachment1.txt"),
},
},
})
}
Expand Down

0 comments on commit 3cf8563

Please sign in to comment.