mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-06 23:16:53 +00:00
* ordermanager: fix residual test issue from #917 and reduce some racey action * glorious: nits; also removed functions that weren't being used and were unexported * rm: pew * linter: fix issues * glourious: nits * credentials: fix test issue with racey racey horse basey
This commit is contained in:
@@ -212,7 +212,6 @@ func TestAreCredentialsValid(t *testing.T) {
|
||||
func TestValidateAPICredentials(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
var b Base
|
||||
type tester struct {
|
||||
Key string
|
||||
Secret string
|
||||
@@ -247,7 +246,8 @@ func TestValidateAPICredentials(t *testing.T) {
|
||||
{RequiresBase64DecodeSecret: true, Secret: "aGVsbG8gd29ybGQ="},
|
||||
}
|
||||
|
||||
setupBase := func(b *Base, tData *tester) {
|
||||
setupBase := func(tData *tester) *Base {
|
||||
b := &Base{}
|
||||
b.API.SetKey(tData.Key)
|
||||
b.API.SetSecret(tData.Secret)
|
||||
b.API.SetClientID(tData.ClientID)
|
||||
@@ -257,13 +257,14 @@ func TestValidateAPICredentials(t *testing.T) {
|
||||
b.API.CredentialsValidator.RequiresPEM = tData.RequiresPEM
|
||||
b.API.CredentialsValidator.RequiresClientID = tData.RequiresClientID
|
||||
b.API.CredentialsValidator.RequiresBase64DecodeSecret = tData.RequiresBase64DecodeSecret
|
||||
return b
|
||||
}
|
||||
|
||||
for x := range testCases {
|
||||
testData := &testCases[x]
|
||||
t.Run("", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
setupBase(&b, testData)
|
||||
b := setupBase(testData)
|
||||
if err := b.ValidateAPICredentials(b.API.credentials); !errors.Is(err, testData.Expected) {
|
||||
t.Errorf("Test %d: expected: %v: got %v", x+1, testData.Expected, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user