diff options
Diffstat (limited to 'src/oauth')
| -rw-r--r-- | src/oauth/auth_header_test.go | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/oauth/auth_header_test.go b/src/oauth/auth_header_test.go index 332b3de..78e568c 100644 --- a/src/oauth/auth_header_test.go +++ b/src/oauth/auth_header_test.go @@ -4,8 +4,6 @@ import ( "net/http" "strings" "testing" - - "github.com/stretchr/testify/assert" ) func TestString_CardmarketDemoValues_Success(t *testing.T) { @@ -45,7 +43,9 @@ func TestString_CardmarketDemoValues_Success(t *testing.T) { actual := ah.String() // Assert - assert.True(t, strings.HasPrefix(actual, "OAuth ")) + if !strings.HasPrefix(actual, "OAuth ") { + t.Errorf(`expected %q to be prefixed with "OAuth "`, actual) + } actualParts := strings.Split(strings.TrimPrefix(actual, "OAuth "), ", ") actualKVs := map[string]string{} @@ -65,7 +65,9 @@ func TestString_CardmarketDemoValues_Success(t *testing.T) { "oauth_signature": `"mRdSwq4vJcmCByd990zE1NTPWJ0%3D"`, } for expectedKey, expectedValue := range expected { - assert.Equal(t, expectedValue, actualKVs[expectedKey]) + if expectedValue != actualKVs[expectedKey] { + t.Errorf("expected: %q, got: %q", expectedValue, actualKVs[expectedKey]) + } } } @@ -111,7 +113,9 @@ func TestBuildBaseString(t *testing.T) { // Assert expected := `GET&https%3A%2F%2Fapiv2.cardmarket.com%2Fws%2Fv2.0%2Faccount&` - assert.Equal(t, expected, actual) + if expected != actual { + t.Errorf("expected: %q, got: %q", expected, actual) + } } func TestBuildParameterString(t *testing.T) { @@ -152,7 +156,9 @@ func TestBuildParameterString(t *testing.T) { // Assert expected := `oauth_consumer_key%3DbfaD9xOU0SXBhtBP%26oauth_nonce%3D53eb1f44909d6%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1407917892%26oauth_token%3DlBY1xptUJ7ZJSK01x4fNwzw8kAe5b10Q%26oauth_version%3D1.0` - assert.Equal(t, expected, actual) + if expected != actual { + t.Errorf("expected: %q, got: %q", expected, actual) + } } func TestPercentEncode(t *testing.T) { @@ -180,7 +186,9 @@ func TestPercentEncode(t *testing.T) { actual := percentEncode(tc.str) // Assert - assert.Equal(t, tc.expected, actual) + if tc.expected != actual { + t.Errorf("expected: %q, got: %q", tc.expected, actual) + } }) } } |
