-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update remote signer for 0.11 (#5602)
* Update remote signer for 0.11 * use signing function for aggregate and proof signature Co-authored-by: Raul Jordan <[email protected]>
- Loading branch information
1 parent
e30349d
commit 9d173dc
Showing
6 changed files
with
144 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package keymanager | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestPathsToVerificationRegexes(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
paths []string | ||
regexes []string | ||
err string | ||
}{ | ||
{ | ||
name: "Empty", | ||
regexes: []string{}, | ||
}, | ||
{ | ||
name: "IgnoreBadPaths", | ||
paths: []string{"", "/", "/Account"}, | ||
regexes: []string{}, | ||
}, | ||
{ | ||
name: "Simple", | ||
paths: []string{"Wallet/Account"}, | ||
regexes: []string{"^Wallet/Account$"}, | ||
}, | ||
{ | ||
name: "Multiple", | ||
paths: []string{"Wallet/Account1", "Wallet/Account2"}, | ||
regexes: []string{"^Wallet/Account1$", "^Wallet/Account2$"}, | ||
}, | ||
{ | ||
name: "IgnoreInvalidRegex", | ||
paths: []string{"Wallet/Account1", "Bad/***", "Wallet/Account2"}, | ||
regexes: []string{"^Wallet/Account1$", "^Wallet/Account2$"}, | ||
}, | ||
{ | ||
name: "TidyExistingAnchors", | ||
paths: []string{"Wallet/^.*$", "Wallet/Foo.*Bar$", "Wallet/^Account"}, | ||
regexes: []string{"^Wallet/.*$", "^Wallet/Foo.*Bar$", "^Wallet/Account$"}, | ||
}, | ||
} | ||
|
||
for _, test := range tests { | ||
t.Run(test.name, func(t *testing.T) { | ||
regexes := pathsToVerificationRegexes(test.paths) | ||
if len(regexes) != len(test.regexes) { | ||
t.Fatalf("Unexpected number of regexes: expected %v, received %v", len(test.regexes), len(regexes)) | ||
} | ||
for i := range regexes { | ||
if regexes[i].String() != test.regexes[i] { | ||
t.Fatalf("Unexpected regex %d: expected %v, received %v", i, test.regexes[i], regexes[i].String()) | ||
} | ||
} | ||
}) | ||
} | ||
} |