diff options
| author | Stefan Majewsky <majewsky@gmx.net> | 2018-03-11 19:38:27 +0100 |
|---|---|---|
| committer | Stefan Majewsky <majewsky@gmx.net> | 2018-03-11 19:41:33 +0100 |
| commit | d23b4052c0866698b14ac13ac98581d9f5440a9b (patch) | |
| tree | 51c93559594f8fd5136fd51b7397a30415ea93aa /tests/bulk_delete_test.go | |
| parent | aaf61ac55e18a04fd68b9b6ee4fd4fce49659eeb (diff) | |
| download | go-schwift-d23b4052c0866698b14ac13ac98581d9f5440a9b.tar.gz | |
revamp the Headers API
1. Move common methods of AccountHeaders, ContainerHeaders,
ObjectHeaders into a base type Headers.
2. Fold Headers into RequestOptions to remove one of the two optional
arguments on request methods. The new Headers.ToOpts() method
offers a nice experience for users passing Headers to request
methods.
The Update() methods keep the explicit Headers argument since the
Headers argument is not optional there.
The only downside is that we lose a bit of type-safety because
RequestOptions takes any Headers instance, so e.g. ContainerHeaders
could be passed to Object.Upload(). I believe the benefits outweigh
this problem.
Diffstat (limited to 'tests/bulk_delete_test.go')
| -rw-r--r-- | tests/bulk_delete_test.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/bulk_delete_test.go b/tests/bulk_delete_test.go index 52294ba..c498419 100644 --- a/tests/bulk_delete_test.go +++ b/tests/bulk_delete_test.go @@ -33,13 +33,13 @@ func TestBulkDeleteSuccess(t *testing.T) { objs, err := createTestObjects(c) expectSuccess(t, err) - numDeleted, numNotFound, err := c.Account().BulkDelete(objs, nil, nil, nil) + numDeleted, numNotFound, err := c.Account().BulkDelete(objs, nil, nil) expectSuccess(t, err) expectInt(t, numDeleted, len(objs)) expectInt(t, numNotFound, 0) expectContainerExistence(t, c, true) - numDeleted, numNotFound, err = c.Account().BulkDelete(objs, nil, nil, nil) + numDeleted, numNotFound, err = c.Account().BulkDelete(objs, nil, nil) expectSuccess(t, err) expectInt(t, numDeleted, 0) expectInt(t, numNotFound, len(objs)) @@ -49,7 +49,7 @@ func TestBulkDeleteSuccess(t *testing.T) { expectSuccess(t, err) cs := []*schwift.Container{c} - numDeleted, numNotFound, err = c.Account().BulkDelete(objs, cs, nil, nil) + numDeleted, numNotFound, err = c.Account().BulkDelete(objs, cs, nil) expectSuccess(t, err) expectInt(t, numDeleted, len(objs)+1) expectInt(t, numNotFound, 0) @@ -65,7 +65,7 @@ func TestBulkDeleteError(t *testing.T) { cs := []*schwift.Container{c} //not deleting all objects should lead to 409 Conflict when deleting the Container - numDeleted, numNotFound, err := c.Account().BulkDelete(objs, cs, nil, nil) + numDeleted, numNotFound, err := c.Account().BulkDelete(objs, cs, nil) expectInt(t, numDeleted, len(objs)) expectInt(t, numNotFound, 0) expectError(t, err, "400 Bad Request (+1 object errors)") @@ -77,7 +77,7 @@ func createTestObjects(c *schwift.Container) ([]*schwift.Object, error) { var objs []*schwift.Object for idx := 1; idx <= 5; idx++ { obj := c.Object(fmt.Sprintf("object%d", idx)) - err := obj.Upload(strings.NewReader("example"), nil, nil) + err := obj.Upload(strings.NewReader("example"), nil) if err != nil { return nil, err } |
