Skip to content

Commit

Permalink
Add missing err check 2 (keybase#11342)
Browse files Browse the repository at this point in the history
* Add missing err check 2

* fix tests
  • Loading branch information
mlsteele authored Apr 12, 2018
1 parent ab8cdb3 commit 0fde99d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
3 changes: 3 additions & 0 deletions go/stellar/stellar.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ func Upkeep(ctx context.Context, g *libkb.GlobalContext) (err error) {

func ImportSecretKey(ctx context.Context, g *libkb.GlobalContext, secretKey stellar1.SecretKey, makePrimary bool) (err error) {
prevBundle, _, err := remote.Fetch(ctx, g)
if err != nil {
return err
}
nextBundle := bundle.Advance(prevBundle)
err = bundle.AddAccount(&nextBundle, secretKey, "", makePrimary)
if err != nil {
Expand Down
12 changes: 10 additions & 2 deletions go/stellar/stellarsvc/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ func TestSendLocalStellarAddress(t *testing.T) {
_, tcs, cleanup := setupNTests(t, 1)
defer cleanup()

_, err := stellar.CreateWallet(context.Background(), tcs[0].G)
require.NoError(t, err)

srv, rm := newTestServer(tcs[0].G)
accountIDSender := rm.AddAccount(t)
accountIDRecip := rm.AddAccount(t)
Expand All @@ -190,7 +193,7 @@ func TestSendLocalStellarAddress(t *testing.T) {
SecretKey: rm.SecretKey(t, accountIDSender),
MakePrimary: true,
}
err := srv.ImportSecretKeyLocal(context.Background(), argImport)
err = srv.ImportSecretKeyLocal(context.Background(), argImport)
require.NoError(t, err)

arg := stellar1.SendLocalArg{
Expand Down Expand Up @@ -219,6 +222,11 @@ func TestSendLocalKeybase(t *testing.T) {
fus, tcs, cleanup := setupNTests(t, 2)
defer cleanup()

_, err := stellar.CreateWallet(context.Background(), tcs[0].G)
require.NoError(t, err)
_, err = stellar.CreateWallet(context.Background(), tcs[1].G)
require.NoError(t, err)

srvSender, rm := newTestServer(tcs[0].G)
accountIDSender := rm.AddAccount(t)
accountIDRecip := rm.AddAccount(t)
Expand All @@ -229,7 +237,7 @@ func TestSendLocalKeybase(t *testing.T) {
SecretKey: rm.SecretKey(t, accountIDSender),
MakePrimary: true,
}
err := srvSender.ImportSecretKeyLocal(context.Background(), argImport)
err = srvSender.ImportSecretKeyLocal(context.Background(), argImport)
require.NoError(t, err)

argImport.SecretKey = rm.SecretKey(t, accountIDRecip)
Expand Down

0 comments on commit 0fde99d

Please sign in to comment.