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

More integration tests for CLI (including minor fixes in CLI) #278

Merged
merged 4 commits into from
May 17, 2019

Conversation

piotr-iohk
Copy link
Contributor

@piotr-iohk piotr-iohk commented May 17, 2019

Issue Number

#96

Overview

  • I have added more tests cases for CLI (including tests for testing wallet creation)
  • Did minor fixes in CLI:
  • making display of help with consistent exit code in cardano-wallet-launcher and cardano-wallet for both parameters (--help and -h)
  • making mnemonic generate to always show Invalid mnemonic size. Expected one of: 9,12,15,18,21,24 for invalid --size (it used to show rather unpleasent Int is an integer number between -9223372036854775808 and 9223372036854775807. when the provided --size was not Int)
  • did slight refactoring (moving data used in test to separate module TestData.hs and extracting methods for interacting with CLI to DSL.hs)

Comments

@piotr-iohk piotr-iohk self-assigned this May 17, 2019
if (title == "40 chars hex") then
c `shouldBe` ExitSuccess
else
c `shouldBe` ExitFailure 1
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is slightly inconsistent I think. I suppose the response code should be always 1 (currently for valid hex, but not existing wallet it is 0, for others it is 1)

Copy link
Member

Choose a reason for hiding this comment

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

Hmmm... That's actually right.

Piotr Stachyra added 3 commits May 17, 2019 12:49
 - moving test data to separate module TestData.hs
 - extracting methods for interacting with CLI to DSL
 - few more test cases
@piotr-iohk piotr-iohk force-pushed the piotr/96/more_cli_cases branch from 9b8ebba to 9935f7c Compare May 17, 2019 10:50
"15" -> mnemonicToText @15 . entropyToMnemonic <$> genEntropy
"18" -> mnemonicToText @18 . entropyToMnemonic <$> genEntropy
"21" -> mnemonicToText @21 . entropyToMnemonic <$> genEntropy
"24" -> mnemonicToText @24 . entropyToMnemonic <$> genEntropy
Copy link
Member

Choose a reason for hiding this comment

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

Sweet :o

hPutStr i (passphrase ++ "\n")
hPutStr i (passphrase ++ "\n")
hFlush i
hClose i
Copy link
Member

Choose a reason for hiding this comment

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

My man ❤️

{ std_in = CreatePipe, std_out = CreatePipe, std_err = CreatePipe }
withCreateProcess process $ \stdIn _ _ h -> do
case stdIn of
Nothing -> return ()
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if this should "throw". Since we use CreatePipe this must be Just. If not, the test might hang forever.

if (title == "40 chars hex") then
c `shouldBe` ExitSuccess
else
c `shouldBe` ExitFailure 1
Copy link
Member

Choose a reason for hiding this comment

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

Hmmm... That's actually right.

@KtorZ KtorZ merged commit 81b746b into master May 17, 2019
@iohk-bors iohk-bors bot deleted the piotr/96/more_cli_cases branch May 17, 2019 13:53
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