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
cd7d9f8e
Commit
cd7d9f8e
authored
Jul 23, 2018
by
Sietse Ringers
Browse files
Tweak and expand logging unit test
parent
06821d1a
Changes
1
Hide whitespace changes
Inline
Side-by-side
irmaclient/irmaclient_test.go
View file @
cd7d9f8e
...
...
@@ -174,9 +174,10 @@ func TestLogging(t *testing.T) {
logs
,
err
:=
client
.
Logs
()
oldLogLength
:=
len
(
logs
)
require
.
NoError
(
t
,
err
)
attrid
:=
irma
.
NewAttributeTypeIdentifier
(
"irma-demo.RU.studentCard.studentID"
)
// Do
session so we can examine its log item later
jwt
:=
getCombinedJwt
(
"testip"
,
irma
.
NewAttributeTypeIdentifier
(
"irma-demo.RU.studentCard.studentID"
)
)
// Do
issuance session
jwt
:=
getCombinedJwt
(
"testip"
,
attrid
)
sessionHelper
(
t
,
jwt
,
"issue"
,
client
)
logs
,
err
=
client
.
Logs
()
...
...
@@ -189,12 +190,15 @@ func TestLogging(t *testing.T) {
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
"testip"
,
sessionjwt
.
(
*
irma
.
IdentityProviderJwt
)
.
ServerName
)
require
.
NoError
(
t
,
err
)
require
.
NotNil
(
t
,
entry
.
IssueCommitment
)
issued
,
err
:=
entry
.
GetIssuedCredentials
(
client
.
Configuration
)
require
.
NoError
(
t
,
err
)
require
.
NotNil
(
t
,
issued
)
disclosed
,
err
:=
entry
.
GetDisclosedCredentials
(
client
.
Configuration
)
require
.
NoError
(
t
,
err
)
require
.
NotEmpty
(
t
,
disclosed
)
jwt
=
getDisclosureJwt
(
"testsp"
,
irma
.
NewAttributeTypeIdentifier
(
"irma-demo.RU.studentCard.studentID"
))
// Do disclosure session
jwt
=
getDisclosureJwt
(
"testsp"
,
attrid
)
sessionHelper
(
t
,
jwt
,
"verification"
,
client
)
logs
,
err
=
client
.
Logs
()
require
.
NoError
(
t
,
err
)
...
...
@@ -206,12 +210,31 @@ func TestLogging(t *testing.T) {
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
"testsp"
,
sessionjwt
.
(
*
irma
.
ServiceProviderJwt
)
.
ServerName
)
require
.
NoError
(
t
,
err
)
require
.
NotNil
(
t
,
entry
.
ProofList
)
disclosed
,
err
=
entry
.
GetDisclosedCredentials
(
client
.
Configuration
)
require
.
NoError
(
t
,
err
)
require
.
NotEmpty
(
t
,
disclosed
)
// Do signature session
jwt
=
getSigningJwt
(
"testsigclient"
,
attrid
)
sessionHelper
(
t
,
jwt
,
"signature"
,
client
)
logs
,
err
=
client
.
Logs
()
require
.
NoError
(
t
,
err
)
require
.
True
(
t
,
len
(
logs
)
==
oldLogLength
+
3
)
entry
=
logs
[
len
(
logs
)
-
1
]
require
.
NotNil
(
t
,
entry
)
sessionjwt
,
err
=
entry
.
Jwt
()
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
"testsigclient"
,
sessionjwt
.
(
*
irma
.
SignatureRequestorJwt
)
.
ServerName
)
require
.
NoError
(
t
,
err
)
sig
,
err
:=
entry
.
GetSignedMessage
()
require
.
NoError
(
t
,
err
)
require
.
NotNil
(
t
,
sig
)
status
,
list
:=
irma
.
VerifySigWithoutRequest
(
client
.
Configuration
,
sig
)
require
.
Equal
(
t
,
irma
.
VALID
,
status
)
require
.
NotEmpty
(
t
,
list
)
require
.
Contains
(
t
,
list
[
0
]
.
Attributes
,
attrid
)
require
.
Equal
(
t
,
"s1234567"
,
list
[
0
]
.
Attributes
[
attrid
][
"en"
])
test
.
ClearTestStorage
(
t
)
}
...
...
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