Commit 78e92305 authored by Ivar Derksen's avatar Ivar Derksen Committed by Sietse Ringers

Improved TestSessionUsingLegacyStorage and deleted some duplicate test code

parent 139f92f5
......@@ -12,15 +12,24 @@ func TestSessionUsingLegacyStorage(t *testing.T) {
defer test.SetTestStorageDir("teststorage")
client, _ := parseStorage(t)
defer test.ClearTestStorage(t)
// Test whether credential from legacy storage is still usable
idStudentCard := irma.NewAttributeTypeIdentifier("irma-demo.RU.studentCard.studentID")
request := getDisclosureRequest(idStudentCard)
sessionHelper(t, request, "verification", client)
// 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
id := irma.NewAttributeTypeIdentifier("irma-demo.MijnOverheid.root.BSN")
sessionHelper(t, getDisclosureRequest(id), "verification", client)
idRoot := irma.NewAttributeTypeIdentifier("irma-demo.MijnOverheid.root.BSN")
sessionHelper(t, getDisclosureRequest(idRoot), "verification", client)
// Re-open client
require.NoError(t, client.Close())
client, _ = parseExistingStorage(t)
// Test whether credential is still there after the storage has been reloaded
sessionHelper(t, getDisclosureRequest(idRoot), "verification", client)
}
......@@ -315,11 +315,8 @@ func TestFreshStorage(t *testing.T) {
path := filepath.Join(test.FindTestdataFolder(t), "storage", "test")
err := fs.EnsureDirectoryExists(path)
require.NoError(t, err)
client, err := New(
filepath.Join("..", "testdata", "storage", "test"),
filepath.Join("..", "testdata", "irma_configuration"),
&TestClientHandler{t: t},
)
client := parseExistingStorage(t)
require.NoError(t, err)
require.NotNil(t, client)
}
......@@ -333,12 +330,8 @@ func TestKeyshareEnrollmentRemoval(t *testing.T) {
err = client.storage.db.Close()
require.NoError(t, err)
client, err = New(
filepath.Join("..", "testdata", "storage", "test"),
filepath.Join("..", "testdata", "irma_configuration"),
&TestClientHandler{t: t},
)
require.NoError(t, err)
client = parseExistingStorage(t)
require.NotContains(t, client.keyshareServers, "test")
}
......@@ -351,11 +344,8 @@ func TestUpdatePreferences(t *testing.T) {
err := client.storage.db.Close()
require.NoError(t, err)
client, err = New(
filepath.Join("..", "testdata", "storage", "test"),
filepath.Join("..", "testdata", "irma_configuration"),
&TestClientHandler{t: t},
)
client = parseExistingStorage(t)
require.NoError(t, err)
require.Equal(t, false, client.Preferences.EnableCrashReporting)
}
......
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