From 56ae9c2051625d63cefdb4d1c7755d5be6ce00a6 Mon Sep 17 00:00:00 2001 From: soulteary Date: Mon, 10 Oct 2022 13:07:40 +0800 Subject: [PATCH] test: simplify test dependencies --- pkg/httpcache/key_test.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pkg/httpcache/key_test.go b/pkg/httpcache/key_test.go index ba2ff77..1ff55a3 100644 --- a/pkg/httpcache/key_test.go +++ b/pkg/httpcache/key_test.go @@ -5,7 +5,6 @@ import ( "testing" "github.com/soulteary/apt-proxy/pkg/httpcache" - "github.com/stretchr/testify/assert" ) func mustParseUrl(u string) *url.URL { @@ -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) { @@ -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) { @@ -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") + } }