itest: refactor testBakeMacaroon
This commit is contained in:
3 files changed
+11
-11
No files matched your search
@@ -349,4 +349,8 @@ var allTestCasesTemp = []*lntemp.TestCase{
|
|||||||
Name: "macaroon authentication",
|
Name: "macaroon authentication",
|
||||||
TestFunc: testMacaroonAuthentication,
|
TestFunc: testMacaroonAuthentication,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Name: "bake macaroon",
|
||||||
|
TestFunc: testBakeMacaroon,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
@@ -296,8 +296,8 @@ func testMacaroonAuthentication(ht *lntemp.HarnessTest) {
|
|||||||
// testBakeMacaroon checks that when creating macaroons, the permissions param
|
// testBakeMacaroon checks that when creating macaroons, the permissions param
|
||||||
// in the request must be set correctly, and the baked macaroon has the intended
|
// in the request must be set correctly, and the baked macaroon has the intended
|
||||||
// permissions.
|
// permissions.
|
||||||
func testBakeMacaroon(net *lntest.NetworkHarness, t *harnessTest) {
|
func testBakeMacaroon(ht *lntemp.HarnessTest) {
|
||||||
var testNode = net.Alice
|
var testNode = ht.Alice
|
||||||
|
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
name string
|
name string
|
||||||
@@ -429,7 +429,7 @@ func testBakeMacaroon(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
|
|
||||||
newMac, err := readMacaroonFromHex(bakeResp.Macaroon)
|
newMac, err := readMacaroonFromHex(bakeResp.Macaroon)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
cleanup, readOnlyClient := macaroonClientOld(
|
cleanup, readOnlyClient := macaroonClient(
|
||||||
t, testNode, newMac,
|
t, testNode, newMac,
|
||||||
)
|
)
|
||||||
defer cleanup()
|
defer cleanup()
|
||||||
@@ -498,17 +498,17 @@ func testBakeMacaroon(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
|
|
||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
tc := tc
|
tc := tc
|
||||||
t.t.Run(tc.name, func(tt *testing.T) {
|
ht.Run(tc.name, func(tt *testing.T) {
|
||||||
ctxt, cancel := context.WithTimeout(
|
ctxt, cancel := context.WithTimeout(
|
||||||
context.Background(), defaultTimeout,
|
ht.Context(), defaultTimeout,
|
||||||
)
|
)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
adminMac, err := testNode.ReadMacaroon(
|
adminMac, err := testNode.ReadMacaroon(
|
||||||
testNode.AdminMacPath(), defaultTimeout,
|
testNode.Cfg.AdminMacPath, defaultTimeout,
|
||||||
)
|
)
|
||||||
require.NoError(tt, err)
|
require.NoError(tt, err)
|
||||||
cleanup, client := macaroonClientOld(tt, testNode, adminMac)
|
cleanup, client := macaroonClient(tt, testNode, adminMac)
|
||||||
defer cleanup()
|
defer cleanup()
|
||||||
|
|
||||||
tc.run(ctxt, tt, client)
|
tc.run(ctxt, tt, client)
|
||||||
|
|||||||
@@ -52,10 +52,6 @@ var allTestCases = []*testCase{
|
|||||||
name: "cpfp",
|
name: "cpfp",
|
||||||
test: testCPFP,
|
test: testCPFP,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: "bake macaroon",
|
|
||||||
test: testBakeMacaroon,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: "delete macaroon id",
|
name: "delete macaroon id",
|
||||||
test: testDeleteMacaroonID,
|
test: testDeleteMacaroonID,
|
||||||
|
|||||||
Reference in new issue
Block a user