diff options
| author | Stefan Majewsky <majewsky@gmx.net> | 2018-02-07 19:33:36 +0100 |
|---|---|---|
| committer | Stefan Majewsky <majewsky@gmx.net> | 2018-02-07 19:33:36 +0100 |
| commit | 801b5207dcbf3438e7612e1f7edc9de32ce0780c (patch) | |
| tree | 6f0454ec49bf769e361cfa393290efc68583ca67 /headers_test.go | |
| parent | 8bddda344201d9f034b5e9c2e9c37a25caeb80cb (diff) | |
| download | go-schwift-801b5207dcbf3438e7612e1f7edc9de32ce0780c.tar.gz | |
switch from reflection to code generation
This allows me to make the API much simpler. More simplification
forthcoming in the following commit; I just want to make a cut since
`make test` is happy right now.
Diffstat (limited to 'headers_test.go')
| -rw-r--r-- | headers_test.go | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/headers_test.go b/headers_test.go index 66a2c36..f8b604c 100644 --- a/headers_test.go +++ b/headers_test.go @@ -24,24 +24,23 @@ import ( ) func TestParseAccountHeadersSuccess(t *testing.T) { - headers := NewAccountHeaders() - headers.FromHTTP(http.Header{ + headers := AccountHeaders(headersFromHTTP(http.Header{ "X-Account-Bytes-Used": {"1234"}, "X-Account-Object-Count": {"42"}, "X-Account-Container-Count": {"23"}, "X-Account-Meta-Quota-Bytes": {"1048576"}, "X-Account-Meta-foo": {"bar"}, - }) + })) expectError(t, headers.Validate(), "") - expectUint64(t, headers.BytesUsed.Get(), 1234) - expectUint64(t, headers.ContainerCount.Get(), 23) - expectUint64(t, headers.ObjectCount.Get(), 42) - expectUint64(t, headers.QuotaBytes.Get(), 1048576) + expectUint64(t, headers.BytesUsed().Get(), 1234) + expectUint64(t, headers.ContainerCount().Get(), 23) + expectUint64(t, headers.ObjectCount().Get(), 42) + expectUint64(t, headers.QuotaBytes().Get(), 1048576) - expectString(t, headers.Metadata.Get("foo"), "bar") - expectString(t, headers.Metadata.Get("Foo"), "bar") - expectString(t, headers.Metadata.Get("FOO"), "bar") + expectString(t, headers.Metadata().Get("foo"), "bar") + expectString(t, headers.Metadata().Get("Foo"), "bar") + expectString(t, headers.Metadata().Get("FOO"), "bar") } //TODO TestParseAccountHeadersError |
