Commit 30d2b590 authored by Sietse Ringers's avatar Sietse Ringers
Browse files

refactor: set entire irmaclient.Preferences instead of just devmode boolean

parent 89a9152f
......@@ -32,7 +32,7 @@ func TestKeyshareRegister(t *testing.T) {
require.NoError(t, client.KeyshareRemoveAll())
require.NoError(t, client.RemoveStorage())
client.SetDeveloperMode(true)
client.SetPreferences(irmaclient.Preferences{DeveloperMode: true})
client.KeyshareEnroll(irma.NewSchemeManagerIdentifier("test"), nil, "12345", "en")
require.NoError(t, <-handler.c)
......
......@@ -51,7 +51,7 @@ func parseExistingStorage(t *testing.T, storage string) (*irmaclient.Client, *Te
handler,
)
require.NoError(t, err)
client.SetDeveloperMode(true)
client.SetPreferences(irmaclient.Preferences{DeveloperMode: true})
return client, handler
}
......
......@@ -120,7 +120,7 @@ func TestLargeAttribute(t *testing.T) {
defer test.ClearTestStorage(t, handler.storage)
require.NoError(t, client.RemoveStorage())
client.SetDeveloperMode(true)
client.SetPreferences(irmaclient.Preferences{DeveloperMode: true})
issuanceRequest := getSpecialIssuanceRequest(false, "1234567890123456789012345678901234567890") // 40 chars
sessionHelper(t, issuanceRequest, "issue", client)
......@@ -203,7 +203,7 @@ func TestAttributeByteEncoding(t *testing.T) {
client, handler := parseStorage(t)
defer test.ClearTestStorage(t, handler.storage)
require.NoError(t, client.RemoveStorage())
client.SetDeveloperMode(true)
client.SetPreferences(irmaclient.Preferences{DeveloperMode: true})
/* After bitshifting the presence bit into the large attribute below, the most significant
bit is 1. In the bigint->[]byte conversion that happens before hashing this attribute, in
......@@ -229,7 +229,7 @@ func TestOutdatedClientIrmaConfiguration(t *testing.T) {
// Remove old studentCard credential from before support for optional attributes, and issue a new one
require.NoError(t, client.RemoveStorage())
client.SetDeveloperMode(true)
client.SetPreferences(irmaclient.Preferences{DeveloperMode: true})
require.Nil(t, requestorSessionHelper(t, getIssuanceRequest(true), client).Err)
// client does not have updated irma_configuration with new attribute irma-demo.RU.studentCard.newAttribute,
......@@ -250,7 +250,7 @@ func TestDisclosureNewAttributeUpdateSchemeManager(t *testing.T) {
// Remove old studentCard credential from before support for optional attributes, and issue a new one
require.NoError(t, client.RemoveStorage())
client.SetDeveloperMode(true)
client.SetPreferences(irmaclient.Preferences{DeveloperMode: true})
require.Nil(t, requestorSessionHelper(t, getIssuanceRequest(true), client).Err)
// Trigger downloading the updated irma_configuration using a disclosure request containing the
......
......@@ -1127,13 +1127,13 @@ func (client *Client) LoadLogsBefore(beforeIndex uint64, max int) ([]*LogEntry,
return client.storage.LoadLogsBefore(beforeIndex, max)
}
func (client *Client) SetDeveloperMode(enable bool) {
if enable {
func (client *Client) SetPreferences(pref Preferences) {
if pref.DeveloperMode {
irma.Logger.Info("developer mode enabled")
} else {
irma.Logger.Info("developer mode disabled")
}
client.Preferences.DeveloperMode = enable
client.Preferences = pref
_ = client.storage.StorePreferences(client.Preferences)
client.applyPreferences()
}
......
......@@ -47,7 +47,7 @@ func parseExistingStorage(t *testing.T, storage string) (*Client, *TestClientHan
handler,
)
require.NoError(t, err)
client.SetDeveloperMode(true)
client.SetPreferences(Preferences{DeveloperMode: true})
return client, handler
}
......
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