macaroons test: fix formatting

This commit is contained in:
Johan T. Halseth 2020-09-24 11:59:08 +02:00
parent 14960b1fb4
commit 65865030d6
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26

@ -19,8 +19,9 @@ var (
) )
func createDummyMacaroon(t *testing.T) *macaroon.Macaroon { func createDummyMacaroon(t *testing.T) *macaroon.Macaroon {
dummyMacaroon, err := macaroon.New(testRootKey, testID, dummyMacaroon, err := macaroon.New(
testLocation, testVersion) testRootKey, testID, testLocation, testVersion,
)
if err != nil { if err != nil {
t.Fatalf("Error creating initial macaroon: %v", err) t.Fatalf("Error creating initial macaroon: %v", err)
} }
@ -36,8 +37,9 @@ func TestAddConstraints(t *testing.T) {
// Now add a constraint and make sure we have a cloned macaroon // Now add a constraint and make sure we have a cloned macaroon
// with the constraint applied instead of a mutated initial one. // with the constraint applied instead of a mutated initial one.
newMac, err := macaroons.AddConstraints(initialMac, newMac, err := macaroons.AddConstraints(
macaroons.TimeoutConstraint(1)) initialMac, macaroons.TimeoutConstraint(1),
)
if err != nil { if err != nil {
t.Fatalf("Error adding constraint: %v", err) t.Fatalf("Error adding constraint: %v", err)
} }
@ -69,8 +71,10 @@ func TestTimeoutConstraint(t *testing.T) {
// Finally, check that the created caveat has an // Finally, check that the created caveat has an
// acceptable value. // acceptable value.
if !strings.HasPrefix(string(testMacaroon.Caveats()[0].Id), if !strings.HasPrefix(
expectedTimeCaveatSubstring) { string(testMacaroon.Caveats()[0].Id),
expectedTimeCaveatSubstring,
) {
t.Fatalf("Added caveat '%s' does not meet the expectations!", t.Fatalf("Added caveat '%s' does not meet the expectations!",
testMacaroon.Caveats()[0].Id) testMacaroon.Caveats()[0].Id)
} }