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
d26dd7a1
Commit
d26dd7a1
authored
Aug 10, 2019
by
Sietse Ringers
Browse files
refactor: rename testdata contents
parent
53a421fd
Changes
17
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
d26dd7a1
*.test
.idea/
testdata/
storage
/*
!testdata/
storage
/cardemu.xml
testdata/
tmp
/*
!testdata/
tmp
/cardemu.xml
errors_*.go
vendor/
\ No newline at end of file
internal/sessiontest/main_test.go
View file @
d26dd7a1
...
...
@@ -44,7 +44,7 @@ func parseExistingStorage(t *testing.T) (*irmaclient.Client, *TestClientHandler)
handler
:=
&
TestClientHandler
{
t
:
t
,
c
:
make
(
chan
error
)}
path
:=
test
.
FindTestdataFolder
(
t
)
client
,
err
:=
irmaclient
.
New
(
filepath
.
Join
(
path
,
"
storage"
,
"tes
t"
),
filepath
.
Join
(
path
,
"
tmp"
,
"clien
t"
),
filepath
.
Join
(
path
,
"irma_configuration"
),
handler
,
)
...
...
internal/sessiontest/requestor_test.go
View file @
d26dd7a1
...
...
@@ -364,7 +364,7 @@ func TestRevocation(t *testing.T) {
client
,
_
:=
parseStorage
(
t
)
iss
:=
irma
.
NewIssuerIdentifier
(
"irma-demo.MijnOverheid"
)
cred
:=
irma
.
NewCredentialTypeIdentifier
(
"irma-demo.MijnOverheid.root"
)
dbPath
:=
filepath
.
Join
(
testdata
,
"
storage
"
,
"revocation"
,
cred
.
String
())
dbPath
:=
filepath
.
Join
(
testdata
,
"
tmp
"
,
"revocation"
,
cred
.
String
())
keystore
:=
client
.
Configuration
.
RevocationKeystore
(
iss
)
sk
,
err
:=
client
.
Configuration
.
PrivateKey
(
iss
)
require
.
NoError
(
t
,
err
)
...
...
internal/sessiontest/server_test.go
View file @
d26dd7a1
...
...
@@ -59,7 +59,7 @@ func StartIrmaServer(t *testing.T, updatedIrmaConf bool) {
URL
:
"http://localhost:48680"
,
Logger
:
logger
,
SchemesPath
:
filepath
.
Join
(
testdata
,
irmaconf
),
RevocationPath
:
filepath
.
Join
(
testdata
,
"
storage
"
,
"revocation"
),
RevocationPath
:
filepath
.
Join
(
testdata
,
"
tmp
"
,
"revocation"
),
})
require
.
NoError
(
t
,
err
)
...
...
@@ -83,7 +83,7 @@ var IrmaServerConfiguration = &requestorserver.Configuration{
Logger
:
logger
,
SchemesPath
:
filepath
.
Join
(
testdata
,
"irma_configuration"
),
IssuerPrivateKeysPath
:
filepath
.
Join
(
testdata
,
"privatekeys"
),
RevocationPath
:
filepath
.
Join
(
testdata
,
"
storage
"
,
"revocation"
),
RevocationPath
:
filepath
.
Join
(
testdata
,
"
tmp
"
,
"revocation"
),
},
DisableRequestorAuthentication
:
true
,
Port
:
48682
,
...
...
@@ -95,7 +95,7 @@ var JwtServerConfiguration = &requestorserver.Configuration{
Logger
:
logger
,
SchemesPath
:
filepath
.
Join
(
testdata
,
"irma_configuration"
),
IssuerPrivateKeysPath
:
filepath
.
Join
(
testdata
,
"privatekeys"
),
RevocationPath
:
filepath
.
Join
(
testdata
,
"
storage
"
,
"revocation"
),
RevocationPath
:
filepath
.
Join
(
testdata
,
"
tmp
"
,
"revocation"
),
},
Port
:
48682
,
DisableRequestorAuthentication
:
false
,
...
...
internal/sessiontest/session_test.go
View file @
d26dd7a1
...
...
@@ -437,7 +437,7 @@ func TestDownloadSchemeManager(t *testing.T) {
require
.
Contains
(
t
,
client
.
Configuration
.
Issuers
,
irma
.
NewIssuerIdentifier
(
"irma-demo.RU"
))
require
.
Contains
(
t
,
client
.
Configuration
.
CredentialTypes
,
irma
.
NewCredentialTypeIdentifier
(
"irma-demo.RU.studentCard"
))
basepath
:=
filepath
.
Join
(
test
.
FindTestdataFolder
(
t
),
"
storage"
,
"tes
t"
,
"irma_configuration"
,
"irma-demo"
)
basepath
:=
filepath
.
Join
(
test
.
FindTestdataFolder
(
t
),
"
tmp"
,
"clien
t"
,
"irma_configuration"
,
"irma-demo"
)
exists
,
err
:=
fs
.
PathExists
(
filepath
.
Join
(
basepath
,
"description.xml"
))
require
.
NoError
(
t
,
err
)
require
.
True
(
t
,
exists
)
...
...
internal/test/testdata.go
View file @
d26dd7a1
...
...
@@ -30,7 +30,7 @@ func checkError(t *testing.T, err error) {
var
schemeServer
*
http
.
Server
var
badServer
*
http
.
Server
var
badServerCount
int
var
testStorageDir
=
"
teststorage
"
var
testStorageDir
=
"
client
"
func
StartSchemeManagerHttpServer
()
{
path
:=
FindTestdataFolder
(
nil
)
...
...
@@ -88,32 +88,22 @@ func FindTestdataFolder(t *testing.T) string {
// ClearTestStorage removes any output from previously run tests to ensure a clean state;
// some of the tests don't like it when there is existing state in storage.
func
ClearTestStorage
(
t
*
testing
.
T
)
{
path
:=
filepath
.
Join
(
FindTestdataFolder
(
t
),
"storage"
)
err
:=
os
.
RemoveAll
(
filepath
.
Join
(
path
,
"test"
))
checkError
(
t
,
err
)
err
=
os
.
RemoveAll
(
filepath
.
Join
(
path
,
"revocation"
))
checkError
(
t
,
err
)
tmp
:=
filepath
.
Join
(
FindTestdataFolder
(
t
),
"tmp"
)
checkError
(
t
,
os
.
RemoveAll
(
tmp
))
checkError
(
t
,
fs
.
EnsureDirectoryExists
(
tmp
))
}
func
CreateTestStorage
(
t
*
testing
.
T
)
{
ClearTestStorage
(
t
)
path
:=
filepath
.
Join
(
FindTestdataFolder
(
t
),
"storage"
)
// EnsureDirectoryExists eventually uses mkdir from the OS which is not recursive
// so we have to create the temporary test storage by multiple function calls.
// We ignore any error possibly returned by creating the first one, because if it errors,
// then the second one certainly will as well.
_
=
fs
.
EnsureDirectoryExists
(
path
)
err
:=
fs
.
EnsureDirectoryExists
(
filepath
.
Join
(
path
,
"test"
))
checkError
(
t
,
err
)
err
=
fs
.
EnsureDirectoryExists
(
filepath
.
Join
(
path
,
"revocation"
))
checkError
(
t
,
err
)
tmp
:=
filepath
.
Join
(
FindTestdataFolder
(
t
),
"tmp"
)
checkError
(
t
,
fs
.
EnsureDirectoryExists
(
filepath
.
Join
(
tmp
,
"client"
)))
checkError
(
t
,
fs
.
EnsureDirectoryExists
(
filepath
.
Join
(
tmp
,
"revocation"
)))
}
func
SetupTestStorage
(
t
*
testing
.
T
)
{
CreateTestStorage
(
t
)
path
:=
FindTestdataFolder
(
t
)
err
:=
fs
.
CopyDirectory
(
filepath
.
Join
(
path
,
testStorageDir
),
filepath
.
Join
(
path
,
"
storage"
,
"tes
t"
))
err
:=
fs
.
CopyDirectory
(
filepath
.
Join
(
path
,
testStorageDir
),
filepath
.
Join
(
path
,
"
tmp"
,
"clien
t"
))
checkError
(
t
,
err
)
}
...
...
irmaclient/irmaclient_legacy_test.go
View file @
d26dd7a1
package
irmaclient
import
(
"github.com/privacybydesign/irmago/internal/test"
"testing"
"github.com/privacybydesign/irmago/internal/test"
)
func
TestConvertingLegacyStorage
(
t
*
testing
.
T
)
{
test
.
SetTestStorageDir
(
"
legacy_teststorage
"
)
defer
test
.
SetTestStorageDir
(
"
teststorage
"
)
test
.
SetTestStorageDir
(
"
client_legacy
"
)
defer
test
.
SetTestStorageDir
(
"
client
"
)
// Test all tests in this file with legacy storage too
t
.
Run
(
"TestVerify"
,
TestVerify
)
...
...
irmaclient/irmaclient_test.go
View file @
d26dd7a1
...
...
@@ -36,7 +36,7 @@ func parseStorage(t *testing.T) *Client {
func
parseExistingStorage
(
t
*
testing
.
T
)
*
Client
{
client
,
err
:=
New
(
filepath
.
Join
(
".."
,
"testdata"
,
"
storage"
,
"tes
t"
),
filepath
.
Join
(
".."
,
"testdata"
,
"
tmp"
,
"clien
t"
),
filepath
.
Join
(
".."
,
"testdata"
,
"irma_configuration"
),
&
TestClientHandler
{
t
:
t
},
)
...
...
@@ -273,7 +273,7 @@ func TestWrongSchemeManager(t *testing.T) {
irmademo
:=
irma
.
NewSchemeManagerIdentifier
(
"irma-demo"
)
require
.
Contains
(
t
,
client
.
Configuration
.
SchemeManagers
,
irmademo
)
require
.
NoError
(
t
,
os
.
Remove
(
filepath
.
Join
(
".."
,
"testdata"
,
"
storage"
,
"tes
t"
,
"irma_configuration"
,
"irma-demo"
,
"index"
)))
require
.
NoError
(
t
,
os
.
Remove
(
filepath
.
Join
(
".."
,
"testdata"
,
"
tmp"
,
"clien
t"
,
"irma_configuration"
,
"irma-demo"
,
"index"
)))
err
:=
client
.
Configuration
.
ParseFolder
()
_
,
ok
:=
err
.
(
*
irma
.
SchemeManagerError
)
...
...
@@ -299,7 +299,7 @@ func TestCredentialInfoListNewAttribute(t *testing.T) {
require
.
NoError
(
t
,
client
.
Configuration
.
ParseFolder
())
require
.
NotNil
(
t
,
client
.
Configuration
.
CredentialTypes
[
credid
]
.
AttributeType
(
attrid
))
// irma-demo.RU.studentCard.newAttribute now exists in the scheme but not in the instance in the test
storage
// irma-demo.RU.studentCard.newAttribute now exists in the scheme but not in the instance in the test
data folder
for
_
,
credinfo
:=
range
client
.
CredentialInfoList
()
{
if
credinfo
.
ID
==
"studentCard"
{
require
.
Nil
(
t
,
credinfo
.
Attributes
[
attrid
])
...
...
irmago_test.go
View file @
d26dd7a1
...
...
@@ -31,7 +31,7 @@ func TestConfigurationAutocopy(t *testing.T) {
test
.
CreateTestStorage
(
t
)
defer
test
.
ClearTestStorage
(
t
)
path
:=
filepath
.
Join
(
"testdata"
,
"
storage"
,
"tes
t"
,
"irma_configuration"
)
path
:=
filepath
.
Join
(
"testdata"
,
"
tmp"
,
"clien
t"
,
"irma_configuration"
)
require
.
NoError
(
t
,
fs
.
CopyDirectory
(
filepath
.
Join
(
"testdata"
,
"irma_configuration"
),
path
))
conf
,
err
:=
NewConfigurationFromAssets
(
path
,
filepath
.
Join
(
"testdata"
,
"irma_configuration_updated"
))
require
.
NoError
(
t
,
err
)
...
...
@@ -80,7 +80,7 @@ func TestInvalidIrmaConfigurationRestoreFromRemote(t *testing.T) {
test
.
CreateTestStorage
(
t
)
defer
test
.
ClearTestStorage
(
t
)
conf
,
err
:=
NewConfigurationFromAssets
(
filepath
.
Join
(
"testdata"
,
"
storage"
,
"tes
t"
,
"irma_configuration"
),
conf
,
err
:=
NewConfigurationFromAssets
(
filepath
.
Join
(
"testdata"
,
"
tmp"
,
"clien
t"
,
"irma_configuration"
),
filepath
.
Join
(
"testdata"
,
"irma_configuration_invalid"
))
require
.
NoError
(
t
,
err
)
...
...
@@ -95,7 +95,7 @@ func TestInvalidIrmaConfigurationRestoreFromAssets(t *testing.T) {
test
.
CreateTestStorage
(
t
)
defer
test
.
ClearTestStorage
(
t
)
conf
,
err
:=
NewConfigurationFromAssets
(
filepath
.
Join
(
"testdata"
,
"
storage"
,
"tes
t"
,
"irma_configuration"
),
conf
,
err
:=
NewConfigurationFromAssets
(
filepath
.
Join
(
"testdata"
,
"
tmp"
,
"clien
t"
,
"irma_configuration"
),
filepath
.
Join
(
"testdata"
,
"irma_configuration_invalid"
))
require
.
NoError
(
t
,
err
)
...
...
testdata/
teststorage
/db
→
testdata/
client
/db
View file @
d26dd7a1
File moved
testdata/
legacy_teststorage
/attrs
→
testdata/
client_legacy
/attrs
View file @
d26dd7a1
File moved
testdata/
legacy_teststorage
/kss
→
testdata/
client_legacy
/kss
View file @
d26dd7a1
File moved
testdata/
legacy_teststorage
/paillier
→
testdata/
client_legacy
/paillier
View file @
d26dd7a1
File moved
testdata/
legacy_teststorage
/sigs/5ac19c13941eb3b3687511a526adc1fdfa7a8c1bc976634e202671c2ba38c9fa
→
testdata/
client_legacy
/sigs/5ac19c13941eb3b3687511a526adc1fdfa7a8c1bc976634e202671c2ba38c9fa
View file @
d26dd7a1
File moved
testdata/
legacy_teststorage
/sigs/dc8d5f252ae0e87db6136ba74598682158bfe8d0d2e2fc4ee61dbf24aa2746d4
→
testdata/
client_legacy
/sigs/dc8d5f252ae0e87db6136ba74598682158bfe8d0d2e2fc4ee61dbf24aa2746d4
View file @
d26dd7a1
File moved
testdata/
legacy_teststorage
/sk
→
testdata/
client_legacy
/sk
View file @
d26dd7a1
File moved
testdata/
legacy_teststorage
/updates
→
testdata/
client_legacy
/updates
View file @
d26dd7a1
File moved
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