split TestCreateAndRecoverAccount

This commit is contained in:
Caner Çıdam 2017-12-28 16:40:56 +03:00 committed by Frank Mueller
parent ca5b34afb7
commit 491b4ca3ce
1 changed files with 9 additions and 6 deletions

View File

@ -185,7 +185,7 @@ func (s *ManagerTestSuite) reinitMock() {
s.accManager.nodeManager = s.nodeManager
}
func (s *ManagerTestSuite) TestCreateAndRecoverAccount() {
func (s *ManagerTestSuite) TestCreateAccount() {
s.reinitMock()
// Don't fail on empty password
@ -193,17 +193,20 @@ func (s *ManagerTestSuite) TestCreateAndRecoverAccount() {
_, _, _, err := s.accManager.CreateAccount(s.password)
s.NoError(err)
// Recover the account using the mnemonic seed and the password
s.nodeManager.EXPECT().AccountKeyStore().Return(nil, testErrKeyStore)
_, _, _, err = s.accManager.CreateAccount(s.password)
s.Equal(err, testErrKeyStore)
}
func (s *ManagerTestSuite) TestRecoverAccount() {
s.reinitMock()
s.nodeManager.EXPECT().AccountKeyStore().Return(s.keyStore, nil)
addr, pubKey, err := s.accManager.RecoverAccount(s.password, s.mnemonic)
s.NoError(err)
s.Equal(s.address, addr)
s.Equal(s.pubKey, pubKey)
s.nodeManager.EXPECT().AccountKeyStore().Return(nil, testErrKeyStore)
_, _, _, err = s.accManager.CreateAccount(s.password)
s.Equal(err, testErrKeyStore)
s.nodeManager.EXPECT().AccountKeyStore().Return(nil, testErrKeyStore)
_, _, err = s.accManager.RecoverAccount(s.password, s.mnemonic)
s.Equal(err, testErrKeyStore)