Skip to content

Commit 6c147e9

Browse files
committed
itest: test account label
1 parent cbc0e81 commit 6c147e9

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

itest/litd_accounts_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package itest
22

33
import (
44
"context"
5+
"fmt"
56
"os"
67
"strings"
78
"testing"
@@ -100,16 +101,30 @@ func runAccountSystemTest(t *harnessTest, node *HarnessNode, hostPort,
100101

101102
// Create a new account with a balance of 50k sats.
102103
const acctBalance uint64 = 50_000
104+
acctLabel := fmt.Sprintf("test account %d", runNumber)
103105
acctResp, err := acctClient.CreateAccount(
104106
ctxm, &litrpc.CreateAccountRequest{
105107
AccountBalance: acctBalance,
108+
Label: acctLabel,
106109
},
107110
)
108111
require.NoError(t.t, err)
109112
require.NotNil(t.t, acctResp)
110113
require.Greater(t.t, len(acctResp.Account.Id), 12)
111114
require.EqualValues(t.t, acctBalance, acctResp.Account.CurrentBalance)
112115
require.EqualValues(t.t, acctBalance, acctResp.Account.InitialBalance)
116+
require.Equal(t.t, acctLabel, acctResp.Account.Label)
117+
118+
// Make sure we can also query the account by its name.
119+
infoResp, err := acctClient.AccountInfo(
120+
ctxm, &litrpc.AccountInfoRequest{
121+
Label: acctLabel,
122+
},
123+
)
124+
require.Equal(t.t, acctResp.Account.Id, infoResp.Id)
125+
require.EqualValues(t.t, acctBalance, infoResp.CurrentBalance)
126+
require.EqualValues(t.t, acctBalance, infoResp.InitialBalance)
127+
require.Equal(t.t, acctLabel, infoResp.Label)
113128

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

0 commit comments

Comments
 (0)