Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
IRMA
Github mirrors
irmago
Commits
68fd4425
Commit
68fd4425
authored
Jun 04, 2017
by
Sietse Ringers
Browse files
Add store parsing test
parent
072251ce
Changes
4
Hide whitespace changes
Inline
Side-by-side
.gitmodules
0 → 100644
View file @
68fd4425
[submodule "testdata/irma_configuration"]
path = testdata/irma_configuration
url = https://github.com/credentials/irma_configuration
descriptions_test.go
0 → 100644
View file @
68fd4425
package
irmago
import
"testing"
func
TestParseStore
(
t
*
testing
.
T
)
{
err
:=
MetaStore
.
ParseFolder
(
"testdata/irma_configuration"
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
}
store.go
View file @
68fd4425
...
...
@@ -26,7 +26,8 @@ type ConfigurationStore struct {
publickeys
map
[
string
]
*
gabi
.
PublicKey
}
// ParseFolder ...
// ParseFolder populates the current store by parsing the specified irma_configuration folder,
// listing the containing scheme managers, issuers, credential types and public keys.
func
(
store
*
ConfigurationStore
)
ParseFolder
(
path
string
)
error
{
return
iterateSubfolders
(
path
,
func
(
dir
string
)
error
{
manager
:=
&
SchemeManagerDescription
{}
...
...
@@ -89,6 +90,9 @@ func (store *ConfigurationStore) parseCredentialsFolder(path string) error {
})
}
// iterateSubfolders iterates over the subfolders of the specified path,
// calling the specified handler each time. If anything goes wrong, or
// if the caller returns a non-nil error, an error is immediately returned.
func
iterateSubfolders
(
path
string
,
handler
func
(
string
)
error
)
error
{
dirs
,
err
:=
filepath
.
Glob
(
path
+
"/*"
)
if
err
!=
nil
{
...
...
irma_configuration
@
d88fff47
Subproject commit d88fff4702df8bd0fedadaf488f1b0f8f579e139
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment