Skip to content

Commit

Permalink
test: simplify test dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
soulteary committed Oct 10, 2022
1 parent 16afb0d commit 56ae9c2
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions pkg/httpcache/key_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"testing"

"github.com/soulteary/apt-proxy/pkg/httpcache"
"github.com/stretchr/testify/assert"
)

func mustParseUrl(u string) *url.URL {
Expand All @@ -31,7 +30,9 @@ func TestRequestKey(t *testing.T) {
k1 := httpcache.NewKey("GET", mustParseUrl("http://x.org/test"), nil)
k2 := httpcache.NewRequestKey(r)

assert.Equal(t, k1.String(), k2.String())
if k1.String() != k2.String() {
t.Fatal("request key should be same")
}
}

func TestVaryKey(t *testing.T) {
Expand All @@ -51,7 +52,9 @@ func TestRequestKeyWithContentLocation(t *testing.T) {
k1 := httpcache.NewKey("GET", mustParseUrl("http://x.org/test2"), nil)
k2 := httpcache.NewRequestKey(r)

assert.Equal(t, k1.String(), k2.String())
if k1.String() != k2.String() {
t.Fatal("request key should with content location")
}
}

func TestRequestKeyWithIllegalContentLocation(t *testing.T) {
Expand All @@ -60,5 +63,7 @@ func TestRequestKeyWithIllegalContentLocation(t *testing.T) {
k1 := httpcache.NewKey("GET", mustParseUrl("http://x.org/test1"), nil)
k2 := httpcache.NewRequestKey(r)

assert.Equal(t, k1.String(), k2.String())
if k1.String() != k2.String() {
t.Fatal("request key should with illegal content location")
}
}

0 comments on commit 56ae9c2

Please sign in to comment.