Skip to content

Commit

Permalink
itest: test account label
Browse files Browse the repository at this point in the history
  • Loading branch information
guggero committed Jul 26, 2023
1 parent cbc0e81 commit 6c147e9
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions itest/litd_accounts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package itest

import (
"context"
"fmt"
"os"
"strings"
"testing"
Expand Down Expand Up @@ -100,16 +101,30 @@ func runAccountSystemTest(t *harnessTest, node *HarnessNode, hostPort,

// Create a new account with a balance of 50k sats.
const acctBalance uint64 = 50_000
acctLabel := fmt.Sprintf("test account %d", runNumber)
acctResp, err := acctClient.CreateAccount(
ctxm, &litrpc.CreateAccountRequest{
AccountBalance: acctBalance,
Label: acctLabel,
},
)
require.NoError(t.t, err)
require.NotNil(t.t, acctResp)
require.Greater(t.t, len(acctResp.Account.Id), 12)
require.EqualValues(t.t, acctBalance, acctResp.Account.CurrentBalance)
require.EqualValues(t.t, acctBalance, acctResp.Account.InitialBalance)
require.Equal(t.t, acctLabel, acctResp.Account.Label)

// Make sure we can also query the account by its name.
infoResp, err := acctClient.AccountInfo(
ctxm, &litrpc.AccountInfoRequest{
Label: acctLabel,
},
)
require.Equal(t.t, acctResp.Account.Id, infoResp.Id)
require.EqualValues(t.t, acctBalance, infoResp.CurrentBalance)
require.EqualValues(t.t, acctBalance, infoResp.InitialBalance)
require.Equal(t.t, acctLabel, infoResp.Label)

// Now we got a new macaroon that has the account caveat attached to it.
ctxa := macaroonContext(ctxt, acctResp.Macaroon)
Expand Down

0 comments on commit 6c147e9

Please sign in to comment.