lox / httpcache

An RFC7234 compliant golang http.Handler for caching HTTP responses
MIT License
264 stars 28 forks source link

Update tests for newer testify lib #12

Closed mpictor closed 9 years ago

mpictor commented 9 years ago

testify has been updated to report failures for assert.Equal when the types are different. This can be fixed like so:

diff --git a/spec_test.go b/spec_test.go
index 700cd6c..e656c74 100644
--- a/spec_test.go
+++ b/spec_test.go
@@ -304,7 +304,7 @@ func TestSpecCacheControlMaxStale(t *testing.T) {
        upstream.timeTravel(time.Second * 90)
        r3 := client.get("/")
        assert.Equal(t, "MISS", r3.cacheStatus)
-       assert.Equal(t, 0, r3.age)
+       assert.Equal(t, time.Duration(0), r3.age)
 }

 func TestSpecValidatingStaleResponsesUnchanged(t *testing.T) {
@@ -334,7 +334,7 @@ func TestSpecValidatingStaleResponsesWithNewContent(t *testing.T) {
        assert.Equal(t, http.StatusOK, r2.Code)
        assert.Equal(t, "MISS", r2.cacheStatus)
        assert.Equal(t, "brand new content", string(r2.body))
-       assert.Equal(t, 0, r2.age)
+       assert.Equal(t, time.Duration(0), r2.age)
 }

 func TestSpecValidatingStaleResponsesWithNewEtag(t *testing.T) {
@@ -458,7 +458,7 @@ func TestSpecFresheningGetWithHeadRequest(t *testing.T) {

        refreshed := client.get("/explicit")
        assert.Equal(t, "HIT", refreshed.cacheStatus)
-       assert.Equal(t, 0, refreshed.age)
+       assert.Equal(t, time.Duration(0), refreshed.age)
        assert.Equal(t, "llamas", refreshed.header.Get("X-Llamas"))
 }
dmitshur commented 9 years ago

@lox (and whoever else is a maintainer of this library), would it be helpful to make a PR that implements this? It's been 23 days since this was reported.

dmitshur commented 9 years ago

There's already a PR to fix this, see #11. @lox, can you merge it?

lox commented 9 years ago

Will do!

On Jun 27, 2015, at 9:29 PM, Dmitri Shuralyov notifications@github.com wrote:

There's already a PR to fix this, see #11. @lox, can you merge it?

— Reply to this email directly or view it on GitHub.

dmitshur commented 9 years ago

Thanks!

I've also noticed you're not watching your own repository, is that intentional? You will miss notifications of new issues and PRs that way.

lox commented 9 years ago

Remedied!

mpictor commented 9 years ago

Strange that I missed that PR when creating this issue. Thanks for meeting, lox!