@@ -27,11 +27,11 @@ func TestGetWalletAccountsLocal(t *testing.T) {
2727
2828 accountID := tcs [0 ].Backend .AddAccount ()
2929
30- argImport := stellar1.ImportSecretKeyLocalArg {
30+ err = tcs [ 0 ]. Srv . ImportSecretKeyLocal ( context . Background (), stellar1.ImportSecretKeyLocalArg {
3131 SecretKey : tcs [0 ].Backend .SecretKey (accountID ),
3232 MakePrimary : true ,
33- }
34- err = tcs [ 0 ]. Srv . ImportSecretKeyLocal ( context . Background (), argImport )
33+ Name : "qq" ,
34+ } )
3535 require .NoError (t , err )
3636
3737 tcs [0 ].Backend .ImportAccountsForUser (tcs [0 ])
@@ -42,26 +42,28 @@ func TestGetWalletAccountsLocal(t *testing.T) {
4242 require .Len (t , accts , 2 )
4343 require .Equal (t , accountID , accts [0 ].AccountID , accountID )
4444 require .True (t , accts [0 ].IsDefault )
45- require .Equal (t , "" , accts [0 ].Name ) // TODO: once we can set the name on an account, check this
45+ require .Equal (t , "qq " , accts [0 ].Name )
4646 require .Equal (t , "10,000.00 XLM" , accts [0 ].BalanceDescription )
4747 require .NotEmpty (t , accts [0 ].Seqno )
4848
4949 require .False (t , accts [1 ].IsDefault )
50- require .Equal (t , "" , accts [1 ].Name )
50+ require .Equal (t , firstAccountName ( t , tcs [ 0 ]) , accts [1 ].Name )
5151 require .Equal (t , "0 XLM" , accts [1 ].BalanceDescription )
5252 require .NotEmpty (t , accts [1 ].Seqno )
5353
5454 // test the singular version as well
5555 argDetails := stellar1.GetWalletAccountLocalArg {AccountID : accountID }
5656 details , err := tcs [0 ].Srv .GetWalletAccountLocal (context .Background (), argDetails )
5757 require .NoError (t , err )
58+ require .Equal (t , "qq" , accts [0 ].Name )
5859 require .True (t , details .IsDefault )
5960 require .Equal (t , "10,000.00 XLM" , details .BalanceDescription )
6061 require .NotEmpty (t , details .Seqno )
6162
6263 argDetails .AccountID = accts [1 ].AccountID
6364 details , err = tcs [0 ].Srv .GetWalletAccountLocal (context .Background (), argDetails )
6465 require .NoError (t , err )
66+ require .Equal (t , firstAccountName (t , tcs [0 ]), accts [1 ].Name )
6567 require .False (t , details .IsDefault )
6668 require .Equal (t , "0 XLM" , details .BalanceDescription )
6769 require .NotEmpty (t , details .Seqno )
@@ -76,11 +78,11 @@ func TestGetAccountAssetsLocalWithBalance(t *testing.T) {
7678
7779 accountID := tcs [0 ].Backend .AddAccount ()
7880
79- argImport := stellar1.ImportSecretKeyLocalArg {
81+ err = tcs [ 0 ]. Srv . ImportSecretKeyLocal ( context . Background (), stellar1.ImportSecretKeyLocalArg {
8082 SecretKey : tcs [0 ].Backend .SecretKey (accountID ),
8183 MakePrimary : true ,
82- }
83- err = tcs [ 0 ]. Srv . ImportSecretKeyLocal ( context . Background (), argImport )
84+ Name : "qq" ,
85+ } )
8486 require .NoError (t , err )
8587
8688 tcs [0 ].Backend .ImportAccountsForUser (tcs [0 ])
@@ -209,7 +211,7 @@ func TestChangeWalletName(t *testing.T) {
209211 accs , err := tcs [0 ].Srv .WalletGetAccountsCLILocal (context .Background ())
210212 require .NoError (t , err )
211213 require .Len (t , accs , 1 )
212- require .Equal (t , accs [0 ].Name , "" )
214+ require .Equal (t , accs [0 ].Name , firstAccountName ( t , tcs [ 0 ]) )
213215
214216 chk := func (name string , expected string ) {
215217 err = tcs [0 ].Srv .ValidateAccountNameLocal (context .Background (), stellar1.ValidateAccountNameLocalArg {Name : name })
@@ -221,7 +223,7 @@ func TestChangeWalletName(t *testing.T) {
221223 }
222224 }
223225
224- chk ("" , "" )
226+ chk ("" , "name required " )
225227 chk ("office lunch money" , "" )
226228 chk ("savings" , "" )
227229 err = tcs [0 ].Srv .ChangeWalletAccountNameLocal (context .Background (), stellar1.ChangeWalletAccountNameLocalArg {
@@ -294,11 +296,11 @@ func TestSetAccountAsDefault(t *testing.T) {
294296 }
295297
296298 for _ , v := range additionalAccs {
297- arg := stellar1.ImportSecretKeyLocalArg {
299+ err = tcs [ 0 ]. Srv . ImportSecretKeyLocal ( context . Background (), stellar1.ImportSecretKeyLocalArg {
298300 SecretKey : tcs [0 ].Backend .SecretKey (v ),
299301 MakePrimary : false ,
300- }
301- err = tcs [ 0 ]. Srv . ImportSecretKeyLocal ( context . Background (), arg )
302+ Name : "qq" ,
303+ } )
302304 require .NoError (t , err )
303305 }
304306
@@ -360,7 +362,7 @@ func testCreateOrLinkNewAccount(t *testing.T, create bool) {
360362
361363 require .Len (t , accts , 2 )
362364 require .True (t , accts [0 ].IsDefault )
363- require .Equal (t , "" , accts [0 ].Name )
365+ require .Equal (t , firstAccountName ( t , tcs [ 0 ]) , accts [0 ].Name )
364366 require .Equal (t , "0 XLM" , accts [0 ].BalanceDescription )
365367 require .False (t , accts [1 ].IsDefault )
366368 require .Equal (t , accID , accts [1 ].AccountID )
@@ -405,6 +407,7 @@ func TestDeleteWallet(t *testing.T) {
405407 err = tcs [0 ].Srv .ImportSecretKeyLocal (context .Background (), stellar1.ImportSecretKeyLocalArg {
406408 SecretKey : tcs [0 ].Backend .SecretKey (accID2 ),
407409 MakePrimary : true ,
410+ Name : "qq" ,
408411 })
409412 require .NoError (t , err )
410413
@@ -604,6 +607,7 @@ func TestGetPaymentsLocal(t *testing.T) {
604607 err = srvSender .ImportSecretKeyLocal (context .Background (), stellar1.ImportSecretKeyLocalArg {
605608 SecretKey : rm .SecretKey (accountIDSender ),
606609 MakePrimary : true ,
610+ Name : "qq" ,
607611 })
608612 require .NoError (t , err )
609613
@@ -616,12 +620,14 @@ func TestGetPaymentsLocal(t *testing.T) {
616620 err = srvRecip .ImportSecretKeyLocal (context .Background (), stellar1.ImportSecretKeyLocalArg {
617621 SecretKey : rm .SecretKey (accountIDRecip ),
618622 MakePrimary : true ,
623+ Name : "uu" ,
619624 })
620625 require .NoError (t , err )
621626
622627 err = srvRecip .ImportSecretKeyLocal (context .Background (), stellar1.ImportSecretKeyLocalArg {
623628 SecretKey : rm .SecretKey (accountIDRecip2 ),
624629 MakePrimary : false ,
630+ Name : "vv" ,
625631 })
626632 require .NoError (t , err )
627633
@@ -705,7 +711,7 @@ func TestGetPaymentsLocal(t *testing.T) {
705711 require .Equal (t , accountIDRecip , * p .ToAccountID )
706712 var toAccountName string
707713 if ! sender {
708- toAccountName = accountIDRecip . String ()
714+ toAccountName = "uu"
709715 }
710716 require .Equal (t , toAccountName , p .ToAccountName , "ToAccountName" )
711717 require .Equal (t , tcs [1 ].Fu .Username , p .ToUsername )
@@ -807,7 +813,7 @@ func TestGetPaymentsLocal(t *testing.T) {
807813 require .Equal (t , accountIDRecip , * p .ToAccountID )
808814 var toAccountName string
809815 if ! sender {
810- toAccountName = accountIDRecip . String ()
816+ toAccountName = "uu"
811817 }
812818 require .Equal (t , toAccountName , p .ToAccountName )
813819 require .Equal (t , tcs [1 ].Fu .Username , p .ToUsername )
@@ -897,7 +903,7 @@ func TestGetPaymentsLocal(t *testing.T) {
897903 require .Equal (t , "" , p .FromAccountName )
898904 require .Equal (t , stellar1 .ParticipantType_STELLAR , p .ToType )
899905 require .Equal (t , accountIDRecip2 , * p .ToAccountID )
900- require .Equal (t , accountIDRecip2 . String () , p .ToAccountName )
906+ require .Equal (t , "vv" , p .ToAccountName )
901907 require .Equal (t , "" , p .ToUsername )
902908 require .Equal (t , "" , p .ToAssertion )
903909 require .NotEmpty (t , p .NoteErr ) // can't send encrypted note to stellar address
@@ -914,6 +920,7 @@ func TestSendToSelf(t *testing.T) {
914920 err := tcs [0 ].Srv .ImportSecretKeyLocal (context .Background (), stellar1.ImportSecretKeyLocalArg {
915921 SecretKey : rm .SecretKey (accountID1 ),
916922 MakePrimary : true ,
923+ Name : "qq" ,
917924 })
918925 require .NoError (t , err )
919926
@@ -925,6 +932,7 @@ func TestSendToSelf(t *testing.T) {
925932
926933 err = tcs [0 ].Srv .ImportSecretKeyLocal (context .Background (), stellar1.ImportSecretKeyLocalArg {
927934 SecretKey : rm .SecretKey (accountID2 ),
935+ Name : "uu" ,
928936 })
929937 require .NoError (t , err )
930938
@@ -1713,3 +1721,9 @@ func (c *chatListener) ChatPaymentInfo(uid keybase1.UID, convID chat1.Conversati
17131721func (c * chatListener ) ChatRequestInfo (uid keybase1.UID , convID chat1.ConversationID , msgID chat1.MessageID , info chat1.UIRequestInfo ) {
17141722 c .requestInfos <- chat1.ChatRequestInfoArg {Uid : uid , ConvID : convID , MsgID : msgID , Info : info }
17151723}
1724+
1725+ func firstAccountName (t testing.TB , tc * TestContext ) string {
1726+ loggedInUsername := tc .G .ActiveDevice .Username (libkb .NewMetaContextForTest (tc .TestContext ))
1727+ require .True (t , loggedInUsername .IsValid ())
1728+ return fmt .Sprintf ("%v's account" , loggedInUsername )
1729+ }
0 commit comments