From d1dec3782fb5f9aa5775dafb0ea1225af6279ed2 Mon Sep 17 00:00:00 2001 From: Stefan Majewsky Date: Mon, 19 Feb 2018 17:58:08 +0100 Subject: replace expectError by expectSuccess where possible --- field_test.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'field_test.go') diff --git a/field_test.go b/field_test.go index c86f07d..539ed74 100644 --- a/field_test.go +++ b/field_test.go @@ -28,17 +28,17 @@ func TestFieldString(t *testing.T) { hdr := make(AccountHeaders) expectBool(t, hdr.TempURLKey().Exists(), false) expectString(t, hdr.TempURLKey().Get(), "") - expectError(t, hdr.Validate(), "") + expectSuccess(t, hdr.Validate()) hdr["X-Account-Meta-Temp-Url-Key"] = "" expectBool(t, hdr.TempURLKey().Exists(), false) expectString(t, hdr.TempURLKey().Get(), "") - expectError(t, hdr.Validate(), "") + expectSuccess(t, hdr.Validate()) hdr["X-Account-Meta-Temp-Url-Key"] = "foo" expectBool(t, hdr.TempURLKey().Exists(), true) expectString(t, hdr.TempURLKey().Get(), "foo") - expectError(t, hdr.Validate(), "") + expectSuccess(t, hdr.Validate()) hdr.TempURLKey().Set("bar") expectHeaders(t, hdr, map[string]string{ @@ -61,7 +61,7 @@ func TestFieldString(t *testing.T) { func TestFieldTimestamp(t *testing.T) { testWithAccount(t, func(a *Account) { hdr, err := a.Headers() - if !expectError(t, err, "") { + if !expectSuccess(t, err) { return } @@ -75,7 +75,7 @@ func TestFieldTimestamp(t *testing.T) { hdr := make(AccountHeaders) expectBool(t, hdr.CreatedAt().Exists(), false) expectBool(t, hdr.CreatedAt().Get().IsZero(), true) - expectError(t, hdr.Validate(), "") + expectSuccess(t, hdr.Validate()) hdr["X-Timestamp"] = "wtf" expectBool(t, hdr.CreatedAt().Exists(), true) @@ -105,7 +105,7 @@ func TestFieldHTTPTimestamp(t *testing.T) { hdr := make(ObjectHeaders) expectBool(t, hdr.UpdatedAt().Exists(), false) expectBool(t, hdr.UpdatedAt().Get().IsZero(), true) - expectError(t, hdr.Validate(), "") + expectSuccess(t, hdr.Validate()) hdr["Last-Modified"] = "wtf" expectBool(t, hdr.UpdatedAt().Exists(), true) @@ -119,12 +119,12 @@ func TestFieldUint64(t *testing.T) { hdr := make(AccountHeaders) expectBool(t, hdr.BytesUsedQuota().Exists(), false) expectUint64(t, hdr.BytesUsedQuota().Get(), 0) - expectError(t, hdr.Validate(), "") + expectSuccess(t, hdr.Validate()) hdr["X-Account-Meta-Quota-Bytes"] = "23" expectBool(t, hdr.BytesUsedQuota().Exists(), true) expectUint64(t, hdr.BytesUsedQuota().Get(), 23) - expectError(t, hdr.Validate(), "") + expectSuccess(t, hdr.Validate()) hdr["X-Account-Meta-Quota-Bytes"] = "-23" expectBool(t, hdr.BytesUsedQuota().Exists(), true) @@ -151,12 +151,12 @@ func TestFieldUint64Readonly(t *testing.T) { hdr := make(AccountHeaders) expectBool(t, hdr.BytesUsed().Exists(), false) expectUint64(t, hdr.BytesUsed().Get(), 0) - expectError(t, hdr.Validate(), "") + expectSuccess(t, hdr.Validate()) hdr["X-Account-Bytes-Used"] = "23" expectBool(t, hdr.BytesUsed().Exists(), true) expectUint64(t, hdr.BytesUsed().Get(), 23) - expectError(t, hdr.Validate(), "") + expectSuccess(t, hdr.Validate()) hdr["X-Account-Bytes-Used"] = "-23" expectBool(t, hdr.BytesUsed().Exists(), true) -- cgit v1.2.3