Skip to content

Commit 01a8353

Browse files
author
Łukasz Gąsior
committed
Fix tests
1 parent f204e6a commit 01a8353

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/test/scala/io/iohk/ethereum/faucet/FaucetApiSpec.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class FaucetApiSpec extends FlatSpec with Matchers with MockFactory with Scalate
3030
val (prvKey, pubKey) = keyPairToByteStrings(walletKeyPair)
3131
val wallet = Wallet(Address(crypto.kec256(pubKey)), prvKey)
3232

33-
val config = FaucetConfig(wallet.address, "", 10, 20, 1, HttpOriginRange.*, "", "", "", 0, 10.seconds, 1024)
33+
val config = FaucetConfig("keyfile", "", "", 10, 20, 1, HttpOriginRange.*, "", "", 0, 10.seconds, 1024)
3434

3535
val mockRpcClient = mock[RpcClient]
3636
val mockKeyStore = mock[KeyStore]
@@ -43,8 +43,8 @@ class FaucetApiSpec extends FlatSpec with Matchers with MockFactory with Scalate
4343

4444
val retTxId = ByteString(Hex.decode("112233"))
4545

46-
(mockKeyStore.unlockAccount _).expects(config.walletAddress, config.walletPassword).returning(Right(wallet))
47-
(mockRpcClient.getNonce _).expects(config.walletAddress).returning(Right(currentNonce))
46+
(mockKeyStore.unlockAccountFromKeyfile _).expects("keyfile", config.walletPassword).returning(Right(wallet))
47+
(mockRpcClient.getNonce _).expects(wallet.address).returning(Right(currentNonce))
4848
(mockRpcClient.sendTransaction _).expects(ByteString(expectedTx)).returning(Right(retTxId))
4949

5050
val faucetApi = new FaucetApi(mockRpcClient, mockKeyStore, config)
@@ -62,15 +62,15 @@ class FaucetApiSpec extends FlatSpec with Matchers with MockFactory with Scalate
6262
val (prvKey, pubKey) = keyPairToByteStrings(walletKeyPair)
6363
val wallet = Wallet(Address(crypto.kec256(pubKey)), prvKey)
6464

65-
val config = FaucetConfig(wallet.address, "", 10, 20, 1, HttpOriginRange.*, "", "", "", 0, 10.seconds, 1024)
65+
val config = FaucetConfig("keyfile", "", "", 10, 20, 1, HttpOriginRange.*, "", "", 0, 10.seconds, 1024)
6666

6767
val mockRpcClient = mock[RpcClient]
6868
val mockKeyStore = mock[KeyStore]
6969

7070
val retTxId = ByteString(Hex.decode(""))
7171

72-
(mockKeyStore.unlockAccount _).expects(config.walletAddress, config.walletPassword).returning(Right(wallet))
73-
(mockRpcClient.getNonce _).expects(config.walletAddress).returning(Right(1))
72+
(mockKeyStore.unlockAccountFromKeyfile _).expects("keyfile", config.walletPassword).returning(Right(wallet))
73+
(mockRpcClient.getNonce _).expects(wallet.address).returning(Right(1))
7474
(mockRpcClient.sendTransaction _).expects(*).returning(Right(retTxId))
7575

7676
val mockClock = mock[Clock]
@@ -97,15 +97,15 @@ class FaucetApiSpec extends FlatSpec with Matchers with MockFactory with Scalate
9797
}
9898

9999
(mockClock.instant _).expects().returning(Instant.ofEpochMilli(15000002))
100-
(mockRpcClient.getNonce _).expects(config.walletAddress).returning(Right(1))
100+
(mockRpcClient.getNonce _).expects(wallet.address).returning(Right(1))
101101
(mockRpcClient.sendTransaction _).expects(*).returning(Right(retTxId))
102102

103103
postRequestFromClient2 ~> Route.seal(faucetApi.route) ~> check {
104104
status shouldEqual StatusCodes.OK
105105
}
106106

107107
(mockClock.instant _).expects().returning(Instant.ofEpochMilli(15011001))
108-
(mockRpcClient.getNonce _).expects(config.walletAddress).returning(Right(1))
108+
(mockRpcClient.getNonce _).expects(wallet.address).returning(Right(1))
109109
(mockRpcClient.sendTransaction _).expects(*).returning(Right(retTxId))
110110

111111
postRequestFromClient1 ~> Route.seal(faucetApi.route) ~> check {

0 commit comments

Comments
 (0)