Files
gocryptotrader/database/models/sqlite3/boil_suites_test.go
Andrew b26ec86d43 Withdraw additional functionality (validation/submission/tracking) (#409)
* reworked request struct and exchange response started work on validation system

* removed import cycle until work around

* Added intial withdraw support via CLI added

* Added Crypto command to gctcli

* moved var declartion to single line

* Test updates for binance and anx

* All exchange tests have been updated test coverage added to validate

* First pass at adding withdrawl select from database

* started adding basic lru cache system

* Added basic LRU cache including Add Get Remove Contains ContainsOrAdd Clear

* wording changes on comments

* removed exported var's in strut as they are not required

* Added README

* README updates

* corrected ID on commands

* rm line :D

* merged in origin/cache

* linter fixes (gofmt)

* Added basic cache lookup to events

* swapped to mutex over rwmutex updated comments

* unexported getNewest & getOldest

* unexported getNewest & getOldest

* Updated comments and cited references in source

* updated comments

* WIP

* Migrated exchange WithdrawFiat wrapper to new struct response

* Migrated exchange WithdrawFiat wrapper to new struct response

* started work on bank management

* Added exchange level banking details back with migration to banking package

* Removed broken tests for now

* Added validation to bank accounts

* removed duplicate bank details from withdraw struct

* Test coverage increased

* gofmt

* merged upstream/master with clean up

* First pass at adding command line linking to gctcli

* added validation for crypto address, added gctcli support to retreive previous withdrawal requests

* general cleanup

* general cleanup

* reordered imports

* Increased test coverage moved to database sublogger

* Pass incorrect currency no longer return error from c.CheckBankAccountConfig

* remove TestMain() for now as other tests in this package will need to be reworked

* Happy little race car

* Reverted to upstream tests

* Added test covarege for validation method, corrected response on cli protobuf

* query clean up and removal of duplicated code

* cleaned up queries into singlem ethod increased test coverage

* Migrated international fund withdraw to new exchange response and added cache size override

* Migrated international fund withdraw to new exchange response and added cache size override

* Extended gctcli commands

* lowered default cache to 25

* small code clean up

* added get by date method

* add returned error

* cli commands cleaing return error on nil results to fix out of bounds

* merged write & read helpers into one for test coverage and increased engine/withdraw test coverage

* gofmt

* Added test coverage for valid ID

* removed unused param

* converted to use timestamp package from protobuf

* gofmt

* use built in RFC3339 timestamp

* remove setting of CreatedAt & UpdatedAt and allow ORm to take care of it

* also use ptype on byid

* code flow improvements

* remove inverse conditional check and linters run

* removed test data

* removed comment

* removed comment

* also write failures to database for auditing

* converted to use default time for start & end

* Default to time.Now() minus 30 days

* Default to time.Now() minus 30 days

* small code clean up

* fixed missing semicolon on migrations, code clean up

* updated sqlite migrations

* Added additonal check for exchange level bank account if global is not found

* case sensativity fix for currency names

* use correct compare

* test coverage fixed

* removed space

* return pointer to banking.Account

* return pointer to banking.Account

* added else check back to validate()

* Added empty string as default to migration over NULL due to retrivial of data
2020-02-26 15:45:13 +11:00

228 lines
9.0 KiB
Go

// Code generated by SQLBoiler 3.5.0-gct (https://github.com/thrasher-corp/sqlboiler). DO NOT EDIT.
// This file is meant to be re-generated in place and/or deleted at any time.
package sqlite3
import "testing"
// This test suite runs each operation test in parallel.
// Example, if your database has 3 tables, the suite will run:
// table1, table2 and table3 Delete in parallel
// table1, table2 and table3 Insert in parallel, and so forth.
// It does NOT run each operation group in parallel.
// Separating the tests thusly grants avoidance of Postgres deadlocks.
func TestParent(t *testing.T) {
t.Run("AuditEvents", testAuditEvents)
t.Run("Scripts", testScripts)
t.Run("ScriptExecutions", testScriptExecutions)
t.Run("WithdrawalCryptos", testWithdrawalCryptos)
t.Run("WithdrawalFiats", testWithdrawalFiats)
t.Run("WithdrawalHistories", testWithdrawalHistories)
}
func TestDelete(t *testing.T) {
t.Run("AuditEvents", testAuditEventsDelete)
t.Run("Scripts", testScriptsDelete)
t.Run("ScriptExecutions", testScriptExecutionsDelete)
t.Run("WithdrawalCryptos", testWithdrawalCryptosDelete)
t.Run("WithdrawalFiats", testWithdrawalFiatsDelete)
t.Run("WithdrawalHistories", testWithdrawalHistoriesDelete)
}
func TestQueryDeleteAll(t *testing.T) {
t.Run("AuditEvents", testAuditEventsQueryDeleteAll)
t.Run("Scripts", testScriptsQueryDeleteAll)
t.Run("ScriptExecutions", testScriptExecutionsQueryDeleteAll)
t.Run("WithdrawalCryptos", testWithdrawalCryptosQueryDeleteAll)
t.Run("WithdrawalFiats", testWithdrawalFiatsQueryDeleteAll)
t.Run("WithdrawalHistories", testWithdrawalHistoriesQueryDeleteAll)
}
func TestSliceDeleteAll(t *testing.T) {
t.Run("AuditEvents", testAuditEventsSliceDeleteAll)
t.Run("Scripts", testScriptsSliceDeleteAll)
t.Run("ScriptExecutions", testScriptExecutionsSliceDeleteAll)
t.Run("WithdrawalCryptos", testWithdrawalCryptosSliceDeleteAll)
t.Run("WithdrawalFiats", testWithdrawalFiatsSliceDeleteAll)
t.Run("WithdrawalHistories", testWithdrawalHistoriesSliceDeleteAll)
}
func TestExists(t *testing.T) {
t.Run("AuditEvents", testAuditEventsExists)
t.Run("Scripts", testScriptsExists)
t.Run("ScriptExecutions", testScriptExecutionsExists)
t.Run("WithdrawalCryptos", testWithdrawalCryptosExists)
t.Run("WithdrawalFiats", testWithdrawalFiatsExists)
t.Run("WithdrawalHistories", testWithdrawalHistoriesExists)
}
func TestFind(t *testing.T) {
t.Run("AuditEvents", testAuditEventsFind)
t.Run("Scripts", testScriptsFind)
t.Run("ScriptExecutions", testScriptExecutionsFind)
t.Run("WithdrawalCryptos", testWithdrawalCryptosFind)
t.Run("WithdrawalFiats", testWithdrawalFiatsFind)
t.Run("WithdrawalHistories", testWithdrawalHistoriesFind)
}
func TestBind(t *testing.T) {
t.Run("AuditEvents", testAuditEventsBind)
t.Run("Scripts", testScriptsBind)
t.Run("ScriptExecutions", testScriptExecutionsBind)
t.Run("WithdrawalCryptos", testWithdrawalCryptosBind)
t.Run("WithdrawalFiats", testWithdrawalFiatsBind)
t.Run("WithdrawalHistories", testWithdrawalHistoriesBind)
}
func TestOne(t *testing.T) {
t.Run("AuditEvents", testAuditEventsOne)
t.Run("Scripts", testScriptsOne)
t.Run("ScriptExecutions", testScriptExecutionsOne)
t.Run("WithdrawalCryptos", testWithdrawalCryptosOne)
t.Run("WithdrawalFiats", testWithdrawalFiatsOne)
t.Run("WithdrawalHistories", testWithdrawalHistoriesOne)
}
func TestAll(t *testing.T) {
t.Run("AuditEvents", testAuditEventsAll)
t.Run("Scripts", testScriptsAll)
t.Run("ScriptExecutions", testScriptExecutionsAll)
t.Run("WithdrawalCryptos", testWithdrawalCryptosAll)
t.Run("WithdrawalFiats", testWithdrawalFiatsAll)
t.Run("WithdrawalHistories", testWithdrawalHistoriesAll)
}
func TestCount(t *testing.T) {
t.Run("AuditEvents", testAuditEventsCount)
t.Run("Scripts", testScriptsCount)
t.Run("ScriptExecutions", testScriptExecutionsCount)
t.Run("WithdrawalCryptos", testWithdrawalCryptosCount)
t.Run("WithdrawalFiats", testWithdrawalFiatsCount)
t.Run("WithdrawalHistories", testWithdrawalHistoriesCount)
}
func TestHooks(t *testing.T) {
t.Run("AuditEvents", testAuditEventsHooks)
t.Run("Scripts", testScriptsHooks)
t.Run("ScriptExecutions", testScriptExecutionsHooks)
t.Run("WithdrawalCryptos", testWithdrawalCryptosHooks)
t.Run("WithdrawalFiats", testWithdrawalFiatsHooks)
t.Run("WithdrawalHistories", testWithdrawalHistoriesHooks)
}
func TestInsert(t *testing.T) {
t.Run("AuditEvents", testAuditEventsInsert)
t.Run("AuditEvents", testAuditEventsInsertWhitelist)
t.Run("Scripts", testScriptsInsert)
t.Run("Scripts", testScriptsInsertWhitelist)
t.Run("ScriptExecutions", testScriptExecutionsInsert)
t.Run("ScriptExecutions", testScriptExecutionsInsertWhitelist)
t.Run("WithdrawalCryptos", testWithdrawalCryptosInsert)
t.Run("WithdrawalCryptos", testWithdrawalCryptosInsertWhitelist)
t.Run("WithdrawalFiats", testWithdrawalFiatsInsert)
t.Run("WithdrawalFiats", testWithdrawalFiatsInsertWhitelist)
t.Run("WithdrawalHistories", testWithdrawalHistoriesInsert)
t.Run("WithdrawalHistories", testWithdrawalHistoriesInsertWhitelist)
}
// TestToOne tests cannot be run in parallel
// or deadlocks can occur.
func TestToOne(t *testing.T) {
t.Run("ScriptExecutionToScriptUsingScript", testScriptExecutionToOneScriptUsingScript)
t.Run("WithdrawalCryptoToWithdrawalHistoryUsingWithdrawalHistory", testWithdrawalCryptoToOneWithdrawalHistoryUsingWithdrawalHistory)
t.Run("WithdrawalFiatToWithdrawalHistoryUsingWithdrawalHistory", testWithdrawalFiatToOneWithdrawalHistoryUsingWithdrawalHistory)
}
// TestOneToOne tests cannot be run in parallel
// or deadlocks can occur.
func TestOneToOne(t *testing.T) {}
// TestToMany tests cannot be run in parallel
// or deadlocks can occur.
func TestToMany(t *testing.T) {
t.Run("ScriptToScriptExecutions", testScriptToManyScriptExecutions)
t.Run("WithdrawalHistoryToWithdrawalCryptos", testWithdrawalHistoryToManyWithdrawalCryptos)
t.Run("WithdrawalHistoryToWithdrawalFiats", testWithdrawalHistoryToManyWithdrawalFiats)
}
// TestToOneSet tests cannot be run in parallel
// or deadlocks can occur.
func TestToOneSet(t *testing.T) {
t.Run("ScriptExecutionToScriptUsingScriptExecutions", testScriptExecutionToOneSetOpScriptUsingScript)
t.Run("WithdrawalCryptoToWithdrawalHistoryUsingWithdrawalCryptos", testWithdrawalCryptoToOneSetOpWithdrawalHistoryUsingWithdrawalHistory)
t.Run("WithdrawalFiatToWithdrawalHistoryUsingWithdrawalFiats", testWithdrawalFiatToOneSetOpWithdrawalHistoryUsingWithdrawalHistory)
}
// TestToOneRemove tests cannot be run in parallel
// or deadlocks can occur.
func TestToOneRemove(t *testing.T) {}
// TestOneToOneSet tests cannot be run in parallel
// or deadlocks can occur.
func TestOneToOneSet(t *testing.T) {}
// TestOneToOneRemove tests cannot be run in parallel
// or deadlocks can occur.
func TestOneToOneRemove(t *testing.T) {}
// TestToManyAdd tests cannot be run in parallel
// or deadlocks can occur.
func TestToManyAdd(t *testing.T) {
t.Run("ScriptToScriptExecutions", testScriptToManyAddOpScriptExecutions)
t.Run("WithdrawalHistoryToWithdrawalCryptos", testWithdrawalHistoryToManyAddOpWithdrawalCryptos)
t.Run("WithdrawalHistoryToWithdrawalFiats", testWithdrawalHistoryToManyAddOpWithdrawalFiats)
}
// TestToManySet tests cannot be run in parallel
// or deadlocks can occur.
func TestToManySet(t *testing.T) {}
// TestToManyRemove tests cannot be run in parallel
// or deadlocks can occur.
func TestToManyRemove(t *testing.T) {}
func TestReload(t *testing.T) {
t.Run("AuditEvents", testAuditEventsReload)
t.Run("Scripts", testScriptsReload)
t.Run("ScriptExecutions", testScriptExecutionsReload)
t.Run("WithdrawalCryptos", testWithdrawalCryptosReload)
t.Run("WithdrawalFiats", testWithdrawalFiatsReload)
t.Run("WithdrawalHistories", testWithdrawalHistoriesReload)
}
func TestReloadAll(t *testing.T) {
t.Run("AuditEvents", testAuditEventsReloadAll)
t.Run("Scripts", testScriptsReloadAll)
t.Run("ScriptExecutions", testScriptExecutionsReloadAll)
t.Run("WithdrawalCryptos", testWithdrawalCryptosReloadAll)
t.Run("WithdrawalFiats", testWithdrawalFiatsReloadAll)
t.Run("WithdrawalHistories", testWithdrawalHistoriesReloadAll)
}
func TestSelect(t *testing.T) {
t.Run("AuditEvents", testAuditEventsSelect)
t.Run("Scripts", testScriptsSelect)
t.Run("ScriptExecutions", testScriptExecutionsSelect)
t.Run("WithdrawalCryptos", testWithdrawalCryptosSelect)
t.Run("WithdrawalFiats", testWithdrawalFiatsSelect)
t.Run("WithdrawalHistories", testWithdrawalHistoriesSelect)
}
func TestUpdate(t *testing.T) {
t.Run("AuditEvents", testAuditEventsUpdate)
t.Run("Scripts", testScriptsUpdate)
t.Run("ScriptExecutions", testScriptExecutionsUpdate)
t.Run("WithdrawalCryptos", testWithdrawalCryptosUpdate)
t.Run("WithdrawalFiats", testWithdrawalFiatsUpdate)
t.Run("WithdrawalHistories", testWithdrawalHistoriesUpdate)
}
func TestSliceUpdateAll(t *testing.T) {
t.Run("AuditEvents", testAuditEventsSliceUpdateAll)
t.Run("Scripts", testScriptsSliceUpdateAll)
t.Run("ScriptExecutions", testScriptExecutionsSliceUpdateAll)
t.Run("WithdrawalCryptos", testWithdrawalCryptosSliceUpdateAll)
t.Run("WithdrawalFiats", testWithdrawalFiatsSliceUpdateAll)
t.Run("WithdrawalHistories", testWithdrawalHistoriesSliceUpdateAll)
}