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
7699c212
Commit
7699c212
authored
Feb 10, 2019
by
Sietse Ringers
Committed by
Tomas
Feb 10, 2019
Browse files
chore: rename flag to local_tests, include all tests except those involving keyshare servers
parent
f15e2e05
Changes
7
Hide whitespace changes
Inline
Side-by-side
internal/sessiontest/keyshare_test.go
0 → 100644
View file @
7699c212
// +build !local_tests
package
sessiontest
import
(
"testing"
"github.com/privacybydesign/irmago"
"github.com/privacybydesign/irmago/internal/test"
"github.com/stretchr/testify/require"
)
func
TestManualKeyShareSession
(
t
*
testing
.
T
)
{
request
:=
"{
\"
nonce
\"
: 0,
\"
context
\"
: 0,
\"
type
\"
:
\"
signing
\"
,
\"
message
\"
:
\"
I owe you everything
\"
,
\"
content
\"
:[{
\"
label
\"
:
\"
Student number (RU)
\"
,
\"
attributes
\"
:[
\"
test.test.mijnirma.email
\"
]}]}"
ms
:=
createManualSessionHandler
(
t
,
nil
)
_
,
status
:=
manualSessionHelper
(
t
,
nil
,
ms
,
request
,
request
,
false
)
require
.
Equal
(
t
,
irma
.
ProofStatusValid
,
status
)
_
,
status
=
manualSessionHelper
(
t
,
nil
,
ms
,
request
,
""
,
false
)
require
.
Equal
(
t
,
irma
.
ProofStatusValid
,
status
)
}
func
TestRequestorIssuanceKeyshareSession
(
t
*
testing
.
T
)
{
testRequestorIssuance
(
t
,
true
)
}
// Use the existing keyshare enrollment and credentials
// in a keyshare session of each session type.
// Use keyshareuser.sql to enroll the user at the keyshare server.
func
TestKeyshareSessions
(
t
*
testing
.
T
)
{
client
:=
parseStorage
(
t
)
defer
test
.
ClearTestStorage
(
t
)
id
:=
irma
.
NewAttributeTypeIdentifier
(
"irma-demo.RU.studentCard.studentID"
)
expiry
:=
irma
.
Timestamp
(
irma
.
NewMetadataAttribute
(
0
)
.
Expiry
())
issuanceRequest
:=
getCombinedIssuanceRequest
(
id
)
issuanceRequest
.
Credentials
=
append
(
issuanceRequest
.
Credentials
,
&
irma
.
CredentialRequest
{
Validity
:
&
expiry
,
CredentialTypeID
:
irma
.
NewCredentialTypeIdentifier
(
"test.test.mijnirma"
),
Attributes
:
map
[
string
]
string
{
"email"
:
"testusername"
},
},
)
sessionHelper
(
t
,
issuanceRequest
,
"issue"
,
client
)
disclosureRequest
:=
getDisclosureRequest
(
id
)
disclosureRequest
.
Content
=
append
(
disclosureRequest
.
Content
,
&
irma
.
AttributeDisjunction
{
Label
:
"foo"
,
Attributes
:
[]
irma
.
AttributeTypeIdentifier
{
irma
.
NewAttributeTypeIdentifier
(
"test.test.mijnirma.email"
)},
},
)
sessionHelper
(
t
,
disclosureRequest
,
"verification"
,
client
)
sigRequest
:=
getSigningRequest
(
id
)
sigRequest
.
Content
=
append
(
sigRequest
.
Content
,
&
irma
.
AttributeDisjunction
{
Label
:
"foo"
,
Attributes
:
[]
irma
.
AttributeTypeIdentifier
{
irma
.
NewAttributeTypeIdentifier
(
"test.test.mijnirma.email"
)},
},
)
sessionHelper
(
t
,
sigRequest
,
"signature"
,
client
)
}
internal/sessiontest/main_test.go
View file @
7699c212
...
...
@@ -227,35 +227,3 @@ func sessionHelper(t *testing.T, request irma.SessionRequest, sessiontype string
require
.
NoError
(
t
,
result
.
Err
)
}
}
func
keyshareSessions
(
t
*
testing
.
T
,
client
*
irmaclient
.
Client
)
{
id
:=
irma
.
NewAttributeTypeIdentifier
(
"irma-demo.RU.studentCard.studentID"
)
expiry
:=
irma
.
Timestamp
(
irma
.
NewMetadataAttribute
(
0
)
.
Expiry
())
issuanceRequest
:=
getCombinedIssuanceRequest
(
id
)
issuanceRequest
.
Credentials
=
append
(
issuanceRequest
.
Credentials
,
&
irma
.
CredentialRequest
{
Validity
:
&
expiry
,
CredentialTypeID
:
irma
.
NewCredentialTypeIdentifier
(
"test.test.mijnirma"
),
Attributes
:
map
[
string
]
string
{
"email"
:
"testusername"
},
},
)
sessionHelper
(
t
,
issuanceRequest
,
"issue"
,
client
)
disclosureRequest
:=
getDisclosureRequest
(
id
)
disclosureRequest
.
Content
=
append
(
disclosureRequest
.
Content
,
&
irma
.
AttributeDisjunction
{
Label
:
"foo"
,
Attributes
:
[]
irma
.
AttributeTypeIdentifier
{
irma
.
NewAttributeTypeIdentifier
(
"test.test.mijnirma.email"
)},
},
)
sessionHelper
(
t
,
disclosureRequest
,
"verification"
,
client
)
sigRequest
:=
getSigningRequest
(
id
)
sigRequest
.
Content
=
append
(
sigRequest
.
Content
,
&
irma
.
AttributeDisjunction
{
Label
:
"foo"
,
Attributes
:
[]
irma
.
AttributeTypeIdentifier
{
irma
.
NewAttributeTypeIdentifier
(
"test.test.mijnirma.email"
)},
},
)
sessionHelper
(
t
,
sigRequest
,
"signature"
,
client
)
}
internal/sessiontest/manual_session_test.go
View file @
7699c212
// +build !unit_tests
package
sessiontest
import
(
...
...
@@ -114,16 +112,6 @@ func TestManualSessionInvalidAttributeValue(t *testing.T) {
require
.
Equal
(
t
,
irma
.
AttributeProofStatusInvalidValue
,
attrs
[
0
]
.
Status
)
}
func
TestManualKeyShareSession
(
t
*
testing
.
T
)
{
request
:=
"{
\"
nonce
\"
: 0,
\"
context
\"
: 0,
\"
type
\"
:
\"
signing
\"
,
\"
message
\"
:
\"
I owe you everything
\"
,
\"
content
\"
:[{
\"
label
\"
:
\"
Student number (RU)
\"
,
\"
attributes
\"
:[
\"
test.test.mijnirma.email
\"
]}]}"
ms
:=
createManualSessionHandler
(
t
,
nil
)
_
,
status
:=
manualSessionHelper
(
t
,
nil
,
ms
,
request
,
request
,
false
)
require
.
Equal
(
t
,
irma
.
ProofStatusValid
,
status
)
_
,
status
=
manualSessionHelper
(
t
,
nil
,
ms
,
request
,
""
,
false
)
require
.
Equal
(
t
,
irma
.
ProofStatusValid
,
status
)
}
func
TestManualSessionMultiProof
(
t
*
testing
.
T
)
{
client
:=
parseStorage
(
t
)
defer
test
.
ClearTestStorage
(
t
)
...
...
internal/sessiontest/requestor_test.go
View file @
7699c212
// +build !unit_tests
package
sessiontest
import
(
...
...
@@ -81,6 +79,10 @@ func TestRequestorDisclosureSession(t *testing.T) {
}
func
TestRequestorIssuanceSession
(
t
*
testing
.
T
)
{
testRequestorIssuance
(
t
,
false
)
}
func
testRequestorIssuance
(
t
*
testing
.
T
,
keyshare
bool
)
{
attrid
:=
irma
.
NewAttributeTypeIdentifier
(
"irma-demo.RU.studentCard.studentID"
)
request
:=
&
irma
.
IssuanceRequest
{
BaseRequest
:
irma
.
BaseRequest
{
Type
:
irma
.
ActionIssuing
},
...
...
@@ -98,10 +100,13 @@ func TestRequestorIssuanceSession(t *testing.T) {
Attributes
:
map
[
string
]
string
{
"BSN"
:
"299792458"
,
},
},
{
CredentialTypeID
:
irma
.
NewCredentialTypeIdentifier
(
"test.test.mijnirma"
),
Attributes
:
map
[
string
]
string
{
"email"
:
"testusername"
},
}}
if
keyshare
{
request
.
Credentials
=
append
(
request
.
Credentials
,
&
irma
.
CredentialRequest
{
CredentialTypeID
:
irma
.
NewCredentialTypeIdentifier
(
"test.test.mijnirma"
),
Attributes
:
map
[
string
]
string
{
"email"
:
"testusername"
},
})
}
request
.
Disclose
=
[]
*
irma
.
AttributeDisjunction
{{
Label
:
"foo"
,
Attributes
:
[]
irma
.
AttributeTypeIdentifier
{
attrid
},
...
...
internal/sessiontest/session_test.go
View file @
7699c212
// +build !unit_tests
package
sessiontest
import
(
...
...
@@ -119,16 +117,6 @@ func TestAttributeByteEncoding(t *testing.T) {
sessionHelper
(
t
,
request
,
"issue"
,
client
)
}
// Use the existing keyshare enrollment and credentials
// in a keyshare session of each session type.
// Use keyshareuser.sql to enroll the user at the keyshare server.
func
TestKeyshareSessions
(
t
*
testing
.
T
)
{
client
:=
parseStorage
(
t
)
defer
test
.
ClearTestStorage
(
t
)
keyshareSessions
(
t
,
client
)
}
func
TestDisclosureNewAttributeUpdateSchemeManager
(
t
*
testing
.
T
)
{
client
:=
parseStorage
(
t
)
defer
test
.
ClearTestStorage
(
t
)
...
...
irmaclient/irmaclient_keyshare_test.go
0 → 100644
View file @
7699c212
// +build !local_tests
package
irmaclient
import
(
"testing"
"github.com/privacybydesign/irmago"
"github.com/privacybydesign/irmago/internal/test"
"github.com/stretchr/testify/require"
)
// Test pinchange interaction
func
TestKeyshareChangePin
(
t
*
testing
.
T
)
{
client
:=
parseStorage
(
t
)
defer
test
.
ClearTestStorage
(
t
)
require
.
NoError
(
t
,
client
.
keyshareChangePinWorker
(
irma
.
NewSchemeManagerIdentifier
(
"test"
),
"12345"
,
"54321"
))
require
.
NoError
(
t
,
client
.
keyshareChangePinWorker
(
irma
.
NewSchemeManagerIdentifier
(
"test"
),
"54321"
,
"12345"
))
}
irmaclient/irmaclient_test.go
View file @
7699c212
// +build !unit_tests
package
irmaclient
import
(
...
...
@@ -209,15 +207,6 @@ func TestWrongSchemeManager(t *testing.T) {
)
}
// Test pinchange interaction
func
TestKeyshareChangePin
(
t
*
testing
.
T
)
{
client
:=
parseStorage
(
t
)
defer
test
.
ClearTestStorage
(
t
)
require
.
NoError
(
t
,
client
.
keyshareChangePinWorker
(
irma
.
NewSchemeManagerIdentifier
(
"test"
),
"12345"
,
"54321"
))
require
.
NoError
(
t
,
client
.
keyshareChangePinWorker
(
irma
.
NewSchemeManagerIdentifier
(
"test"
),
"54321"
,
"12345"
))
}
// ------
type
TestClientHandler
struct
{
...
...
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