input-output-hk / cardano-sl

Cryptographic currency implementing Ouroboros PoS protocol
Apache License 2.0
3.78k stars 632 forks source link

[CBR-533] add a new endpoint to calculate the walletid for a given mnemonic #4237

Closed cleverca22 closed 4 years ago

cleverca22 commented 4 years ago

Description

Linked issue

Type of change

Developer checklist

Testing checklist

QA Steps

Screenshots (if available)

How to merge

Send the message bors r+ to merge this PR. For more information, see docs/how-to/bors.md.

tatyanavych commented 4 years ago

@cleverca22 Please, add CHANGELOG.md entry under Unreleased in Features section (the section does not exist - needs to be created). Could you also add Fixes section below for the existed entry? So to have:

Unreleased

Features

Fixes

cleverca22 commented 4 years ago

@KtorZ without some chain state to fire up the wallet, i don't know how to test this endpoint fully in an automated manner

all other review comments should be good

KtorZ commented 4 years ago

@cleverca22 For the testing, have a look at some integration test scenarios (e.g. https://github.com/input-output-hk/cardano-sl/blob/develop/wallet/test/integration/Test/Integration/Scenario/Wallets.hs#L579-L601)

You should be able to do something like:

    scenario "Can query wallet id and balance using only its mnemonic" $
            fixture <- setup $ defaultSetup
                & initialCoins .~ [14]

            successfulRequest $ Client.deleteWallet
                $- (fixture ^. wallet . walletId)

            response <- request $ Client.calculateMnemonic 
                $- (fixture ^. backupPhrase)
                $- (Just True) 

            verify response
                [ expectFieldEqual walletId (fixture ^. wallet . walletId)
                , expectFieldEqual maybeBalance (Just 14)
                ]

+/- the compilation errors and testing with various scenarios (with the query parameter, without, testing on a wallet with no funds etc ..)

disassembler commented 4 years ago

bors r+

iohk-bors[bot] commented 4 years ago

:-1: Rejected by too few approved reviews

disassembler commented 4 years ago

bors r+

iohk-bors[bot] commented 4 years ago

Build succeeded