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
78e92305
Commit
78e92305
authored
Jan 31, 2020
by
Ivar Derksen
Committed by
Sietse Ringers
Feb 05, 2020
Browse files
Improved TestSessionUsingLegacyStorage and deleted some duplicate test code
parent
139f92f5
Changes
2
Hide whitespace changes
Inline
Side-by-side
internal/sessiontest/legacy_test.go
View file @
78e92305
...
...
@@ -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
)
}
irmaclient/irmaclient_test.go
View file @
78e92305
...
...
@@ -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
)
}
...
...
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