Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
irmago
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
IRMA
Github mirrors
irmago
Commits
c0fc4c6f
Commit
c0fc4c6f
authored
Jan 09, 2020
by
Ivar Derksen
Committed by
Sietse Ringers
Feb 05, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added legacy tests for irmaclient
parent
c3b43386
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
96 additions
and
1 deletion
+96
-1
internal/test/testdata.go
internal/test/testdata.go
+6
-1
irmaclient/irmaclient_legacy_test.go
irmaclient/irmaclient_legacy_test.go
+24
-0
irmaclient/irmaclient_test.go
irmaclient/irmaclient_test.go
+66
-0
testdata/legacy_teststorage/attrs
testdata/legacy_teststorage/attrs
+0
-0
testdata/legacy_teststorage/kss
testdata/legacy_teststorage/kss
+0
-0
testdata/legacy_teststorage/paillier
testdata/legacy_teststorage/paillier
+0
-0
testdata/legacy_teststorage/sigs/4ffa7efdb5bc9c8c455d65398560183a0d5c9504dfa216755ea4d9c560f1c7d8
...db5bc9c8c455d65398560183a0d5c9504dfa216755ea4d9c560f1c7d8
+0
-0
testdata/legacy_teststorage/sigs/d0d89412643f3fee7858653a35ef15d64bdf2082067999d49f14a7b97999a80d
...2643f3fee7858653a35ef15d64bdf2082067999d49f14a7b97999a80d
+0
-0
testdata/legacy_teststorage/sk
testdata/legacy_teststorage/sk
+0
-0
testdata/legacy_teststorage/updates
testdata/legacy_teststorage/updates
+0
-0
testdata/teststorage/db
testdata/teststorage/db
+0
-0
No files found.
internal/test/testdata.go
View file @
c0fc4c6f
...
...
@@ -30,6 +30,7 @@ func checkError(t *testing.T, err error) {
var
schemeServer
*
http
.
Server
var
badServer
*
http
.
Server
var
badServerCount
int
var
testStorageDir
=
"teststorage"
func
StartSchemeManagerHttpServer
()
{
path
:=
FindTestdataFolder
(
nil
)
...
...
@@ -108,7 +109,7 @@ func CreateTestStorage(t *testing.T) {
func
SetupTestStorage
(
t
*
testing
.
T
)
{
CreateTestStorage
(
t
)
path
:=
FindTestdataFolder
(
t
)
err
:=
fs
.
CopyDirectory
(
filepath
.
Join
(
path
,
"teststorage"
),
filepath
.
Join
(
path
,
"storage"
,
"test"
))
err
:=
fs
.
CopyDirectory
(
filepath
.
Join
(
path
,
testStorageDir
),
filepath
.
Join
(
path
,
"storage"
,
"test"
))
checkError
(
t
,
err
)
}
...
...
@@ -117,3 +118,7 @@ func PrettyPrint(t *testing.T, ob interface{}) string {
require
.
NoError
(
t
,
err
)
return
string
(
b
)
}
func
SetTestStorageDir
(
dir
string
)
{
testStorageDir
=
dir
}
irmaclient/irmaclient_legacy_test.go
0 → 100644
View file @
c0fc4c6f
package
irmaclient
import
(
"github.com/privacybydesign/irmago/internal/test"
"testing"
)
func
TestConvertingLegacyStorage
(
t
*
testing
.
T
)
{
test
.
SetTestStorageDir
(
"legacy_teststorage"
)
// Test all tests in this file with legacy storage too
t
.
Run
(
"TestVerify"
,
TestVerify
)
t
.
Run
(
"TestStorageDeserialization"
,
TestStorageDeserialization
)
t
.
Run
(
"TestCandidates"
,
TestCandidates
)
t
.
Run
(
"TestCandidateConjunctionOrder"
,
TestCandidateConjunctionOrder
)
t
.
Run
(
"TestCredentialRemoval"
,
TestCredentialRemoval
)
t
.
Run
(
"TestWrongSchemeManager"
,
TestWrongSchemeManager
)
t
.
Run
(
"TestCredentialInfoListNewAttribute"
,
TestCredentialInfoListNewAttribute
)
// TestFreshStorage is not needed, because this test does not use an existing storage
t
.
Run
(
"TestKeyshareEnrollmentRemoval"
,
TestKeyshareEnrollmentRemoval
)
t
.
Run
(
"TestUpdatePreferences"
,
TestUpdatePreferences
)
test
.
SetTestStorageDir
(
"teststorage"
)
}
irmaclient/irmaclient_test.go
View file @
c0fc4c6f
...
...
@@ -3,6 +3,7 @@ package irmaclient
import
(
"encoding/json"
"errors"
"github.com/privacybydesign/irmago/internal/fs"
"os"
"path/filepath"
"testing"
...
...
@@ -250,6 +251,19 @@ func TestCredentialRemoval(t *testing.T) {
cred
,
err
=
client
.
credential
(
id2
,
0
)
require
.
NoError
(
t
,
err
)
require
.
Nil
(
t
,
cred
)
// Also check whether credential is removed after reloading the storage
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
)
cred
,
err
=
client
.
credential
(
id2
,
0
)
require
.
NoError
(
t
,
err
)
require
.
Nil
(
t
,
cred
)
}
func
TestWrongSchemeManager
(
t
*
testing
.
T
)
{
...
...
@@ -295,6 +309,58 @@ func TestCredentialInfoListNewAttribute(t *testing.T) {
require
.
Fail
(
t
,
"studentCard credential not found"
)
}
func
TestFreshStorage
(
t
*
testing
.
T
)
{
test
.
CreateTestStorage
(
t
)
defer
test
.
ClearTestStorage
(
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
},
)
require
.
NoError
(
t
,
err
)
require
.
NotNil
(
t
,
client
)
}
func
TestKeyshareEnrollmentRemoval
(
t
*
testing
.
T
)
{
client
:=
parseStorage
(
t
)
defer
test
.
ClearTestStorage
(
t
)
err
:=
client
.
KeyshareRemove
(
irma
.
NewSchemeManagerIdentifier
(
"test"
))
require
.
NoError
(
t
,
err
)
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
)
require
.
NotContains
(
t
,
client
.
keyshareServers
,
"test"
)
}
func
TestUpdatePreferences
(
t
*
testing
.
T
)
{
client
:=
parseStorage
(
t
)
defer
test
.
ClearTestStorage
(
t
)
client
.
SetCrashReportingPreference
(
!
defaultPreferences
.
EnableCrashReporting
)
client
.
applyPreferences
()
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
)
require
.
Equal
(
t
,
false
,
client
.
Preferences
.
EnableCrashReporting
)
}
// ------
type
TestClientHandler
struct
{
...
...
testdata/teststorage/attrs
→
testdata/
legacy_
teststorage/attrs
View file @
c0fc4c6f
File moved
testdata/teststorage/kss
→
testdata/
legacy_
teststorage/kss
View file @
c0fc4c6f
File moved
testdata/teststorage/paillier
→
testdata/
legacy_
teststorage/paillier
View file @
c0fc4c6f
File moved
testdata/teststorage/sigs/4ffa7efdb5bc9c8c455d65398560183a0d5c9504dfa216755ea4d9c560f1c7d8
→
testdata/
legacy_
teststorage/sigs/4ffa7efdb5bc9c8c455d65398560183a0d5c9504dfa216755ea4d9c560f1c7d8
View file @
c0fc4c6f
File moved
testdata/teststorage/sigs/d0d89412643f3fee7858653a35ef15d64bdf2082067999d49f14a7b97999a80d
→
testdata/
legacy_
teststorage/sigs/d0d89412643f3fee7858653a35ef15d64bdf2082067999d49f14a7b97999a80d
View file @
c0fc4c6f
File moved
testdata/teststorage/sk
→
testdata/
legacy_
teststorage/sk
View file @
c0fc4c6f
File moved
testdata/teststorage/updates
→
testdata/
legacy_
teststorage/updates
View file @
c0fc4c6f
File moved
testdata/teststorage/db
0 → 100644
View file @
c0fc4c6f
File added
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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