@@ -2,6 +2,7 @@ package itest
2
2
3
3
import (
4
4
"context"
5
+ "fmt"
5
6
"os"
6
7
"strings"
7
8
"testing"
@@ -100,16 +101,30 @@ func runAccountSystemTest(t *harnessTest, node *HarnessNode, hostPort,
100
101
101
102
// Create a new account with a balance of 50k sats.
102
103
const acctBalance uint64 = 50_000
104
+ acctLabel := fmt .Sprintf ("test account %d" , runNumber )
103
105
acctResp , err := acctClient .CreateAccount (
104
106
ctxm , & litrpc.CreateAccountRequest {
105
107
AccountBalance : acctBalance ,
108
+ Label : acctLabel ,
106
109
},
107
110
)
108
111
require .NoError (t .t , err )
109
112
require .NotNil (t .t , acctResp )
110
113
require .Greater (t .t , len (acctResp .Account .Id ), 12 )
111
114
require .EqualValues (t .t , acctBalance , acctResp .Account .CurrentBalance )
112
115
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 )
113
128
114
129
// Now we got a new macaroon that has the account caveat attached to it.
115
130
ctxa := macaroonContext (ctxt , acctResp .Macaroon )
0 commit comments