sharedtestvalues: Add helper functions and implement throughout exchange tests (#1163)

* exchanges/sharedtestvalues: implement new functions to handle test skipping and announcements for standardising.

* exchanges: fin test impl.

* linter: fixes

* exchange_template: fix test

* allocate so it doesn't make a panic at the disco

* glorious: nits

* glorious: nits

* Update exchanges/sharedtestvalues/sharedtestvalues.go

Co-authored-by: Scott <gloriousCode@users.noreply.github.com>

* Update exchanges/sharedtestvalues/sharedtestvalues.go

Co-authored-by: Scott <gloriousCode@users.noreply.github.com>

* glorious: nits

* linter: fix

* linter: shhhh

---------

Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
This commit is contained in:
Ryan O'Hara-Reid
2023-04-28 13:05:42 +10:00
committed by GitHub
parent 492ea20f21
commit b20cf75d13
63 changed files with 2115 additions and 3161 deletions

View File

@@ -90,7 +90,7 @@ func (b *Base) CheckCredentials(creds *account.Credentials, isContext bool) erro
// Individual package usage, allow request if API credentials are valid a
// and without needing to set AuthenticatedSupport to true
if !b.LoadedByConfig {
return b.ValidateAPICredentials(creds)
return b.VerifyAPICredentials(creds)
}
// Bot usage, AuthenticatedSupport can be disabled by user if desired, so
@@ -102,13 +102,13 @@ func (b *Base) CheckCredentials(creds *account.Credentials, isContext bool) erro
// Check to see if the user has enabled AuthenticatedSupport, but has
// invalid API credentials set and loaded by config
return b.ValidateAPICredentials(creds)
return b.VerifyAPICredentials(creds)
}
// AreCredentialsValid returns if the supplied credentials are valid.
func (b *Base) AreCredentialsValid(ctx context.Context) bool {
creds, err := b.GetCredentials(ctx)
return err == nil && b.ValidateAPICredentials(creds) == nil
return err == nil && b.VerifyAPICredentials(creds) == nil
}
// GetDefaultCredentials returns the exchange.Base api credentials loaded by
@@ -158,8 +158,8 @@ func (b *Base) GetCredentials(ctx context.Context) (*account.Credentials, error)
return &creds, nil
}
// ValidateAPICredentials validates the exchanges API credentials
func (b *Base) ValidateAPICredentials(creds *account.Credentials) error {
// VerifyAPICredentials verifies the exchanges API credentials
func (b *Base) VerifyAPICredentials(creds *account.Credentials) error {
b.API.credMu.RLock()
defer b.API.credMu.RUnlock()
if creds.IsEmpty() {