lnd+macaroons: specify location when creating macaroon service

To allow the macaroon service to be used in other projects, we want the
location to be passed in as a parameter instead of being hard coded.
This commit is contained in:
Oliver Gugger
2020-07-13 16:33:39 +02:00
parent 8668248d96
commit d4c4cf01f0
3 changed files with 15 additions and 7 deletions

View File

@@ -66,7 +66,9 @@ func TestNewService(t *testing.T) {
// Second, create the new service instance, unlock it and pass in a
// checker that we expect it to add to the bakery.
service, err := macaroons.NewService(tempDir, macaroons.IPLockChecker)
service, err := macaroons.NewService(
tempDir, "lnd", macaroons.IPLockChecker,
)
if err != nil {
t.Fatalf("Error creating new service: %v", err)
}
@@ -115,7 +117,9 @@ func TestValidateMacaroon(t *testing.T) {
// First, initialize the service and unlock it.
tempDir := setupTestRootKeyStorage(t)
defer os.RemoveAll(tempDir)
service, err := macaroons.NewService(tempDir, macaroons.IPLockChecker)
service, err := macaroons.NewService(
tempDir, "lnd", macaroons.IPLockChecker,
)
if err != nil {
t.Fatalf("Error creating new service: %v", err)
}
@@ -173,7 +177,9 @@ func TestListMacaroonIDs(t *testing.T) {
// Second, create the new service instance, unlock it and pass in a
// checker that we expect it to add to the bakery.
service, err := macaroons.NewService(tempDir, macaroons.IPLockChecker)
service, err := macaroons.NewService(
tempDir, "lnd", macaroons.IPLockChecker,
)
require.NoError(t, err, "Error creating new service")
defer service.Close()
@@ -203,7 +209,9 @@ func TestDeleteMacaroonID(t *testing.T) {
// Second, create the new service instance, unlock it and pass in a
// checker that we expect it to add to the bakery.
service, err := macaroons.NewService(tempDir, macaroons.IPLockChecker)
service, err := macaroons.NewService(
tempDir, "lnd", macaroons.IPLockChecker,
)
require.NoError(t, err, "Error creating new service")
defer service.Close()