Commit 68fd4425 authored by Sietse Ringers's avatar Sietse Ringers
Browse files

Add store parsing test

parent 072251ce
[submodule "testdata/irma_configuration"]
path = testdata/irma_configuration
url = https://github.com/credentials/irma_configuration
package irmago
import "testing"
func TestParseStore(t *testing.T) {
err := MetaStore.ParseFolder("testdata/irma_configuration")
if err != nil {
t.Fatal(err)
}
}
......@@ -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 {
......
Subproject commit d88fff4702df8bd0fedadaf488f1b0f8f579e139
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment