Commit 3d0e89b7 authored by Ivar Derksen's avatar Ivar Derksen Committed by Sietse Ringers

Added legacy storage tests for internal/sessiontest

parent c0fc4c6f
package sessiontest
import (
irma "github.com/privacybydesign/irmago"
"github.com/privacybydesign/irmago/internal/test"
"github.com/stretchr/testify/require"
"testing"
)
func TestSessionUsingLegacyStorage(t *testing.T) {
test.SetTestStorageDir("legacy_teststorage")
client, _ := parseStorage(t)
// Issue new credential
sessionHelper(t, getMultipleIssuanceRequest(), "issue", client)
// Close client to prevent database to be opened twice
err := client.Close()
require.NoError(t, err)
// Test whether credential is still there
require.NoError(t, err)
id := irma.NewAttributeTypeIdentifier("irma-demo.MijnOverheid.root.BSN")
sessionHelper(t, getDisclosureRequest(id), "verification", client)
test.SetTestStorageDir("teststorage")
}
......@@ -186,6 +186,10 @@ func New(
return cm, schemeMgrErr
}
func (client *Client) Close() error {
return client.storage.Close()
}
// CredentialInfoList returns a list of information of all contained credentials.
func (client *Client) CredentialInfoList() irma.CredentialInfoList {
list := irma.CredentialInfoList([]*irma.CredentialInfo{})
......
......@@ -56,6 +56,10 @@ func (s *storage) EnsureStorageExists() error {
return err
}
func (s *storage) Close() error {
return s.db.Close()
}
func (s *storage) txStore(tx *bbolt.Tx, key string, value interface{}, bucketName string) error {
b, err := tx.CreateBucketIfNotExists([]byte(bucketName))
if err != nil {
......
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