Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wallet create tests #194

Merged
merged 6 commits into from
May 2, 2019
Merged

Wallet create tests #194

merged 6 commits into from
May 2, 2019

Conversation

piotr-iohk
Copy link
Contributor

@piotr-iohk piotr-iohk commented Apr 29, 2019

Issue Number

Overview

  • I have added tests for wallet creation focusing on wallet name and mnemonic_sentence
  • Still to add more test touching on other parameters (mnemonic_second_factor, passphrase, poolgap) and some more negative tests producing various error messages...

Comments

@piotr-iohk piotr-iohk self-assigned this Apr 29, 2019
@@ -168,7 +168,7 @@ instance FromText WalletName where
| T.length t < walletNameMinLength =
Left $ TextDecodingError $
"name is too short: expected at least "
<> show walletNameMinLength <> " chars"
<> show walletNameMinLength <> " char"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

characters ?

@@ -102,9 +109,246 @@ spec = do
r2 <- request @ApiWallet ctx ("POST", "v2/wallets") Default payload
expectResponseCode @IO HTTP.status409 r2

describe "WALLETS_CREATE_04 - Wallet name" $ do
let walNameMax = T.pack (replicate walletNameMaxLength 'ą')
let matrix = [ ( show walletNameMinLength ++ " char long"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Careful with the variable-length indentation here (and below) 🙏


describe "WALLETS_CREATE_05 - Mnemonics" $ do
let matrix = [ ( "[] as mnemonic_sentence -> fail"
, []
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, indentation please 😬

, specMnemonicSentence
, [ expectResponseCode @IO HTTP.status400
, expectErrorMessage "ErrMnemonicWords (ErrWrongNumberOfWords 15 24)"
] -- probably need to modify after bug #192 fixed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed. Let's get #192 resolved today and merge this one after in its corrected form 👍

@piotr-iohk piotr-iohk force-pushed the piotr/create-wallet-tests branch 2 times, most recently from ed48147 to 79dd1e6 Compare April 30, 2019 11:45
Copy link
Contributor Author

@piotr-iohk piotr-iohk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KtorZ I have aligned the test after #197. In some cases there are some different than expected errors thrown. Please have a look at the comments inline...

I have also added cases for passphrase and mnemonic_second_factor. I want to add more tests for address_pool_gap and some destructive scenarios, but maybe I can add it on another PR - not to make this one too big.

)
, ( "Japanese mnemonics -> fail", japaneseMnemonics15
, [ expectResponseCode @IO HTTP.status400
, expectErrorMessage "Found invalid (non-English) word: "
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KtorZ here Found invalid (non-English) word: only for Japanese mnemonics, for Chinese and French throws Invalid number of words. Why is that?

, [ expectResponseCode @IO HTTP.status400
, expectErrorMessage "Invalid number of words: 9 or 12\
\ words are expected."
] -- why not Invalid entropy checksum ?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here I was expecting Invalid entropy checksum. The mnemonic list is invalid...

, ( "Chinese mnemonics -> fail", chineseMnemonics9
, [ expectResponseCode @IO HTTP.status400
, expectErrorMessage "Found invalid (non-English) word:"
] -- why only for Chinese?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again Found invalid (non-English) word:. This time for Chinese mnemonics...
for Japanese and French it throws Invalid number of words:

, ( "-1 -> fail", (-1)
, [ expectResponseCode @IO HTTP.status400
, expectErrorMessage "ErrGapOutOfRange 255"
] -- probably to be modified after #204
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KtorZ - I pushed tests for address_pool_gap here after all. Also created #204 as discussed.

Copy link
Member

@KtorZ KtorZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, merging as is, will add more tests in additional PRs (and fix error messages after #204)

@KtorZ KtorZ force-pushed the piotr/create-wallet-tests branch from 8ec7915 to 3cb5659 Compare May 2, 2019 11:15
@KtorZ KtorZ merged commit d5f0647 into master May 2, 2019
@KtorZ KtorZ deleted the piotr/create-wallet-tests branch May 2, 2019 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants