Skip to content

Commit

Permalink
rename NewApplicationWith{KeyStore,Key}
Browse files Browse the repository at this point in the history
  • Loading branch information
dimroc authored and se3000 committed Feb 13, 2019
1 parent 84986fa commit 8e4df13
Show file tree
Hide file tree
Showing 20 changed files with 70 additions and 70 deletions.
22 changes: 11 additions & 11 deletions adapters/eth_tx_test.go
Expand Up @@ -21,7 +21,7 @@ import (
func TestEthTxAdapter_Perform_Confirmed(t *testing.T) {
t.Parallel()

app, cleanup := cltest.NewApplicationWithKeyStore()
app, cleanup := cltest.NewApplicationWithKey()
defer cleanup()
store := app.Store
config := store.Config
Expand Down Expand Up @@ -81,7 +81,7 @@ func TestEthTxAdapter_Perform_Confirmed(t *testing.T) {
func TestEthTxAdapter_Perform_ConfirmedWithBytes(t *testing.T) {
t.Parallel()

app, cleanup := cltest.NewApplicationWithKeyStore()
app, cleanup := cltest.NewApplicationWithKey()
defer cleanup()
store := app.Store
config := store.Config
Expand Down Expand Up @@ -144,7 +144,7 @@ func TestEthTxAdapter_Perform_ConfirmedWithBytes(t *testing.T) {
func TestEthTxAdapter_Perform_ConfirmedWithBytesAndNoDataPrefix(t *testing.T) {
t.Parallel()

app, cleanup := cltest.NewApplicationWithKeyStore()
app, cleanup := cltest.NewApplicationWithKey()
defer cleanup()
store := app.Store
config := store.Config
Expand Down Expand Up @@ -209,7 +209,7 @@ func TestEthTxAdapter_Perform_ConfirmedWithBytesAndNoDataPrefix(t *testing.T) {
func TestEthTxAdapter_Perform_FromPendingConfirmations_StillPending(t *testing.T) {
t.Parallel()

app, cleanup := cltest.NewApplicationWithKeyStore()
app, cleanup := cltest.NewApplicationWithKey()
defer cleanup()
store := app.Store
config := store.Config
Expand Down Expand Up @@ -245,7 +245,7 @@ func TestEthTxAdapter_Perform_FromPendingConfirmations_StillPending(t *testing.T
func TestEthTxAdapter_Perform_FromPendingConfirmations_BumpGas(t *testing.T) {
t.Parallel()

app, cleanup := cltest.NewApplicationWithKeyStore()
app, cleanup := cltest.NewApplicationWithKey()
defer cleanup()
store := app.Store
config := store.Config
Expand Down Expand Up @@ -285,7 +285,7 @@ func TestEthTxAdapter_Perform_FromPendingConfirmations_BumpGas(t *testing.T) {
func TestEthTxAdapter_Perform_FromPendingConfirmations_ConfirmCompletes(t *testing.T) {
t.Parallel()

app, cleanup := cltest.NewApplicationWithKeyStore()
app, cleanup := cltest.NewApplicationWithKey()
defer cleanup()

store := app.Store
Expand Down Expand Up @@ -341,7 +341,7 @@ func TestEthTxAdapter_Perform_FromPendingConfirmations_ConfirmCompletes(t *testi
func TestEthTxAdapter_Perform_AppendingTransactionReceipts(t *testing.T) {
t.Parallel()

app, cleanup := cltest.NewApplicationWithKeyStore()
app, cleanup := cltest.NewApplicationWithKey()
defer cleanup()

store := app.Store
Expand Down Expand Up @@ -380,7 +380,7 @@ func TestEthTxAdapter_Perform_AppendingTransactionReceipts(t *testing.T) {
func TestEthTxAdapter_Perform_WithError(t *testing.T) {
t.Parallel()

app, cleanup := cltest.NewApplicationWithKeyStore()
app, cleanup := cltest.NewApplicationWithKey()
defer cleanup()

store := app.Store
Expand All @@ -403,7 +403,7 @@ func TestEthTxAdapter_Perform_WithError(t *testing.T) {
func TestEthTxAdapter_Perform_WithErrorInvalidInput(t *testing.T) {
t.Parallel()

app, cleanup := cltest.NewApplicationWithKeyStore()
app, cleanup := cltest.NewApplicationWithKey()
defer cleanup()

store := app.Store
Expand All @@ -426,7 +426,7 @@ func TestEthTxAdapter_Perform_WithErrorInvalidInput(t *testing.T) {
func TestEthTxAdapter_Perform_PendingConfirmations_WithErrorInTxManager(t *testing.T) {
t.Parallel()

app, cleanup := cltest.NewApplicationWithKeyStore()
app, cleanup := cltest.NewApplicationWithKey()
defer cleanup()

store := app.Store
Expand Down Expand Up @@ -523,7 +523,7 @@ func TestEthTxAdapter_Perform_CustomGas(t *testing.T) {
func TestEthTxAdapter_Perform_NotConnected(t *testing.T) {
t.Parallel()

app, cleanup := cltest.NewApplicationWithKeyStore()
app, cleanup := cltest.NewApplicationWithKey()
defer cleanup()
store := app.Store

Expand Down
4 changes: 2 additions & 2 deletions cmd/key_store_authenticator_test.go
Expand Up @@ -44,7 +44,7 @@ func TestTerminalKeyStoreAuthenticator_WithNoAcctWithInitialPwdCreatesAcct(t *te
func TestTerminalKeyStoreAuthenticator_WithAcctNoInitialPwdPromptLoop(t *testing.T) {
t.Parallel()

app, cleanup := cltest.NewApplicationWithKeyStore()
app, cleanup := cltest.NewApplicationWithKey()
defer cleanup()

// prompt loop tries all in array
Expand All @@ -61,7 +61,7 @@ func TestTerminalKeyStoreAuthenticator_WithAcctNoInitialPwdPromptLoop(t *testing
func TestTerminalKeyStoreAuthenticator_WithAcctAndPwd(t *testing.T) {
t.Parallel()

app, cleanup := cltest.NewApplicationWithKeyStore()
app, cleanup := cltest.NewApplicationWithKey()
defer cleanup()

tests := []struct {
Expand Down
4 changes: 2 additions & 2 deletions cmd/local_client_test.go
Expand Up @@ -23,7 +23,7 @@ func TestClient_RunNodeShowsEnv(t *testing.T) {
config.Set("LINK_CONTRACT_ADDRESS", "0x514910771AF9Ca656af840dff83E8264EcF986CA")
config.Set("CHAINLINK_PORT", 6688)

app, cleanup := cltest.NewApplicationWithConfigAndKeyStore(config)
app, cleanup := cltest.NewApplicationWithConfigAndKey(config)
defer cleanup()

auth := cltest.CallbackAuthenticator{Callback: func(*store.Store, string) (string, error) { return "", nil }}
Expand Down Expand Up @@ -139,7 +139,7 @@ func TestClient_RunNodeWithAPICredentialsFile(t *testing.T) {

for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
app, cleanup := cltest.NewApplicationWithKeyStore()
app, cleanup := cltest.NewApplicationWithKey()
defer cleanup()

noauth := cltest.CallbackAuthenticator{Callback: func(*store.Store, string) (string, error) { return "", nil }}
Expand Down
8 changes: 4 additions & 4 deletions cmd/remote_client_test.go
Expand Up @@ -17,7 +17,7 @@ import (
func TestClient_DisplayAccountBalance(t *testing.T) {
t.Parallel()

app, cleanup := cltest.NewApplicationWithKeyStore()
app, cleanup := cltest.NewApplicationWithKey()
defer cleanup()

ethMock := app.MockEthClient()
Expand Down Expand Up @@ -124,7 +124,7 @@ func TestClient_ShowJobSpec_NotFound(t *testing.T) {
func TestClient_CreateServiceAgreement(t *testing.T) {
t.Parallel()

app, cleanup := cltest.NewApplicationWithKeyStore()
app, cleanup := cltest.NewApplicationWithKey()
defer cleanup()
client, _ := app.NewClientAndRenderer()

Expand Down Expand Up @@ -465,7 +465,7 @@ func setupWithdrawalsApplication() (*cltest.TestApplication, func(), func(*testi
config, _ := cltest.NewConfig()
oca := common.HexToAddress("0xDEADB3333333F")
config.Set("ORACLE_CONTRACT_ADDRESS", &oca)
app, cleanup := cltest.NewApplicationWithConfigAndKeyStore(config)
app, cleanup := cltest.NewApplicationWithConfigAndKey(config)

hash := cltest.NewHash()
sentAt := "0x5BA0"
Expand Down Expand Up @@ -561,7 +561,7 @@ func TestClient_ChangePassword(t *testing.T) {
func TestClient_GetTxAttempts(t *testing.T) {
t.Parallel()

app, cleanup := cltest.NewApplicationWithKeyStore()
app, cleanup := cltest.NewApplicationWithKey()
defer cleanup()

store := app.GetStore()
Expand Down
6 changes: 3 additions & 3 deletions integration/features_test.go
Expand Up @@ -44,7 +44,7 @@ func TestIntegration_HelloWorld(t *testing.T) {
mockServer, assertCalled := cltest.NewHTTPMockServer(t, 200, "GET", tickerResponse)
defer assertCalled()

app, cleanup := cltest.NewApplicationWithKeyStore()
app, cleanup := cltest.NewApplicationWithKey()
defer cleanup()
config := app.Config
eth := app.MockEthClient(cltest.Strict)
Expand Down Expand Up @@ -476,7 +476,7 @@ func TestIntegration_MultiplierUint256(t *testing.T) {
func TestIntegration_NonceManagement_firstRunWithExistingTXs(t *testing.T) {
t.Parallel()

app, cleanup := cltest.NewApplicationWithKeyStore()
app, cleanup := cltest.NewApplicationWithKey()
defer cleanup()

j := cltest.FixtureCreateJobViaWeb(t, app, "../internal/fixtures/web/web_initiated_eth_tx_job.json")
Expand Down Expand Up @@ -517,7 +517,7 @@ func TestIntegration_NonceManagement_firstRunWithExistingTXs(t *testing.T) {
func TestIntegration_CreateServiceAgreement(t *testing.T) {
t.Parallel()

app, cleanup := cltest.NewApplicationWithKeyStore()
app, cleanup := cltest.NewApplicationWithKey()
defer cleanup()

eth := app.MockEthClient()
Expand Down
10 changes: 5 additions & 5 deletions internal/cltest/cltest.go
Expand Up @@ -183,19 +183,19 @@ func NewApplicationWithConfig(tc *TestConfig) (*TestApplication, func()) {
}
}

// NewApplicationWithKeyStore creates a new TestApplication along with a new config
func NewApplicationWithKeyStore() (*TestApplication, func()) {
// NewApplicationWithKey creates a new TestApplication along with a new config
func NewApplicationWithKey() (*TestApplication, func()) {
config, cfgCleanup := NewConfig()
app, cleanup := NewApplicationWithConfigAndKeyStore(config)
app, cleanup := NewApplicationWithConfigAndKey(config)
return app, func() {
cleanup()
cfgCleanup()
}
}

// NewApplicationWithConfigAndKeyStore creates a new TestApplication with the given testconfig
// NewApplicationWithConfigAndKey creates a new TestApplication with the given testconfig
// it will also provide an unlocked account on the keystore
func NewApplicationWithConfigAndKeyStore(tc *TestConfig) (*TestApplication, func()) {
func NewApplicationWithConfigAndKey(tc *TestConfig) (*TestApplication, func()) {
app, cleanup := NewApplicationWithConfig(tc)
app.ImportKey(key3cb8e3fd9d27e39a5e9e6852b0e96160061fd4ea)
return app, cleanup
Expand Down
10 changes: 5 additions & 5 deletions store/eth_client_test.go
Expand Up @@ -39,7 +39,7 @@ func TestTxReceipt_UnmarshalJSON(t *testing.T) {

func TestEthClient_GetNonce(t *testing.T) {
t.Parallel()
app, cleanup := cltest.NewApplicationWithKeyStore()
app, cleanup := cltest.NewApplicationWithKey()
defer cleanup()
ethMock := app.MockEthClient()
ethClientObject := app.Store.TxManager.(*strpkg.EthTxManager).EthClient
Expand All @@ -52,7 +52,7 @@ func TestEthClient_GetNonce(t *testing.T) {

func TestEthClient_GetBlockNumber(t *testing.T) {
t.Parallel()
app, cleanup := cltest.NewApplicationWithKeyStore()
app, cleanup := cltest.NewApplicationWithKey()
defer cleanup()
ethMock := app.MockEthClient()
ethClientObject := app.Store.TxManager.(*strpkg.EthTxManager).EthClient
Expand All @@ -65,7 +65,7 @@ func TestEthClient_GetBlockNumber(t *testing.T) {

func TestEthClient_SendRawTx(t *testing.T) {
t.Parallel()
app, cleanup := cltest.NewApplicationWithKeyStore()
app, cleanup := cltest.NewApplicationWithKey()
defer cleanup()
ethMock := app.MockEthClient()
ethClientObject := app.Store.TxManager.(*strpkg.EthTxManager).EthClient
Expand All @@ -77,7 +77,7 @@ func TestEthClient_SendRawTx(t *testing.T) {

func TestEthClient_GetEthBalance(t *testing.T) {
t.Parallel()
app, cleanup := cltest.NewApplicationWithKeyStore()
app, cleanup := cltest.NewApplicationWithKey()
defer cleanup()

tests := []struct {
Expand All @@ -104,7 +104,7 @@ func TestEthClient_GetEthBalance(t *testing.T) {

func TestEthClient_GetERC20Balance(t *testing.T) {
t.Parallel()
app, cleanup := cltest.NewApplicationWithKeyStore()
app, cleanup := cltest.NewApplicationWithKey()
defer cleanup()

ethMock := app.MockEthClient()
Expand Down
2 changes: 1 addition & 1 deletion store/models/log_events_test.go
Expand Up @@ -227,7 +227,7 @@ func TestStartRunOrSALogSubscription_ValidateSenders(t *testing.T) {

for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
app, cleanup := cltest.NewApplicationWithKeyStore()
app, cleanup := cltest.NewApplicationWithKey()
defer cleanup()

eth := app.MockEthClient()
Expand Down
4 changes: 2 additions & 2 deletions store/orm/orm_test.go
Expand Up @@ -328,7 +328,7 @@ func TestORM_PendingBridgeType_success(t *testing.T) {

func TestORM_GetLastNonce_StormNotFound(t *testing.T) {
t.Parallel()
app, cleanup := cltest.NewApplicationWithKeyStore()
app, cleanup := cltest.NewApplicationWithKey()
defer cleanup()
store := app.Store

Expand All @@ -341,7 +341,7 @@ func TestORM_GetLastNonce_StormNotFound(t *testing.T) {

func TestORM_GetLastNonce_Valid(t *testing.T) {
t.Parallel()
app, cleanup := cltest.NewApplicationWithKeyStore()
app, cleanup := cltest.NewApplicationWithKey()
defer cleanup()
store := app.Store
manager := store.TxManager
Expand Down
6 changes: 3 additions & 3 deletions store/store_test.go
Expand Up @@ -19,7 +19,7 @@ import (
func TestStore_Start(t *testing.T) {
t.Parallel()

app, cleanup := cltest.NewApplicationWithKeyStore()
app, cleanup := cltest.NewApplicationWithKey()
defer cleanup()

store := app.Store
Expand Down Expand Up @@ -88,7 +88,7 @@ func TestStore_SyncDiskKeyStoreToDB_HappyPath(t *testing.T) {
func TestStore_SyncDiskKeyStoreToDB_MultipleKeys(t *testing.T) {
t.Parallel()

app, cleanup := cltest.NewApplicationWithKeyStore()
app, cleanup := cltest.NewApplicationWithKey()
app.AddUnlockedKey() // second account
defer cleanup()

Expand Down Expand Up @@ -136,7 +136,7 @@ func TestStore_SyncDiskKeyStoreToDB_MultipleKeys(t *testing.T) {
func TestStore_SyncDiskKeyStoreToDB_DBKeyAlreadyExists(t *testing.T) {
t.Parallel()

app, cleanup := cltest.NewApplicationWithKeyStore()
app, cleanup := cltest.NewApplicationWithKey()
defer cleanup()
require.NoError(t, app.StartAndConnect())
store := app.GetStore()
Expand Down

0 comments on commit 8e4df13

Please sign in to comment.