From ca80140c1ae7264a4d8a6ac01fc9384464d3591c Mon Sep 17 00:00:00 2001 From: Samuel Hawksby-Robinson Date: Thu, 10 Dec 2020 16:24:19 +0000 Subject: [PATCH] Resolved broken tests --- images/identity_test.go | 2 +- protocol/messenger_emoji_test.go | 1 + services/status/account_mock.go | 12 +++++++----- services/status/api_test.go | 13 +++++++++++-- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/images/identity_test.go b/images/identity_test.go index 794dec61e..6e4751b8d 100644 --- a/images/identity_test.go +++ b/images/identity_test.go @@ -63,7 +63,7 @@ func TestIdentityImage_MarshalJSON(t *testing.T) { FileSize: 256, ResizeTarget: 80, } - expected := `{"key_uid":"","type":"thumbnail","uri":"data:image/jpeg;base64,/9j/2wCEAFA3PEY8MlA=","width":80,"height":80,"file_size":256,"resize_target":80}` + expected := `{"keyUid":"","type":"thumbnail","uri":"data:image/jpeg;base64,/9j/2wCEAFA3PEY8MlA=","width":80,"height":80,"fileSize":256,"resizeTarget":80}` js, err := json.Marshal(ii) require.NoError(t, err) diff --git a/protocol/messenger_emoji_test.go b/protocol/messenger_emoji_test.go index 8c3812067..9adb57fa8 100644 --- a/protocol/messenger_emoji_test.go +++ b/protocol/messenger_emoji_test.go @@ -91,6 +91,7 @@ func (s *MessengerEmojiSuite) newMessenger(shh types.Waku) *Messenger { func (s *MessengerEmojiSuite) TestSendEmoji() { alice := s.m + alice.account = &multiaccounts.Account{KeyUID: "0xdeadbeef"} key, err := crypto.GenerateKey() s.Require().NoError(err) diff --git a/services/status/account_mock.go b/services/status/account_mock.go index 16728cf41..6b3edfb88 100644 --- a/services/status/account_mock.go +++ b/services/status/account_mock.go @@ -11,6 +11,7 @@ import ( gomock "github.com/golang/mock/gomock" account "github.com/status-im/status-go/account" + "github.com/status-im/status-go/account/generator" types "github.com/status-im/status-go/eth-node/types" ) @@ -106,13 +107,14 @@ func (mr *MockAccountManagerMockRecorder) SelectAccount(arg0 interface{}) *gomoc } // CreateAccount mocks base method -func (m *MockAccountManager) CreateAccount(password string) (account.Info, string, error) { +func (m *MockAccountManager) CreateAccount(password string) (generator.GeneratedAccountInfo, account.Info, string, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "CreateAccount", password) - ret0, _ := ret[0].(account.Info) - ret1, _ := ret[1].(string) - ret2, _ := ret[2].(error) - return ret0, ret1, ret2 + ret0, _ := ret[0].(generator.GeneratedAccountInfo) + ret1, _ := ret[1].(account.Info) + ret2, _ := ret[2].(string) + ret3, _ := ret[3].(error) + return ret0, ret1, ret2, ret3 } // CreateAccount indicates an expected call of CreateAccount diff --git a/services/status/api_test.go b/services/status/api_test.go index 22a26f9e0..8398c286e 100644 --- a/services/status/api_test.go +++ b/services/status/api_test.go @@ -4,6 +4,7 @@ import ( "context" "crypto/ecdsa" "errors" + "github.com/status-im/status-go/account/generator" "testing" "github.com/golang/mock/gomock" @@ -131,13 +132,17 @@ var signuptests = []struct { }, expectedError: nil, prepareExpectations: func(s *StatusSuite) { + mKInfo := generator.GeneratedAccountInfo{ + IdentifiedAccountInfo: generator.IdentifiedAccountInfo{}, + Mnemonic: "", + } accountInfo := account.Info{ WalletAddress: "addr", WalletPubKey: "pubkey", ChatAddress: "addr", ChatPubKey: "pubkey", } - s.am.EXPECT().CreateAccount("password").Return(accountInfo, "mnemonic", nil) + s.am.EXPECT().CreateAccount("password").Return(mKInfo, accountInfo, "mnemonic", nil) }, }, { @@ -149,7 +154,11 @@ var signuptests = []struct { }, expectedError: errors.New("could not create the specified account : foo"), prepareExpectations: func(s *StatusSuite) { - s.am.EXPECT().CreateAccount("password").Return(account.Info{}, "", errors.New("foo")) + mKInfo := generator.GeneratedAccountInfo{ + IdentifiedAccountInfo: generator.IdentifiedAccountInfo{}, + Mnemonic: "", + } + s.am.EXPECT().CreateAccount("password").Return(mKInfo, account.Info{}, "", errors.New("foo")) }, }, }