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
94b9d8ce
Commit
94b9d8ce
authored
Jul 28, 2018
by
Sietse Ringers
Browse files
Rename test manual session handler struct
parent
394c10f0
Changes
2
Hide whitespace changes
Inline
Side-by-side
irmaclient/handlers_test.go
View file @
94b9d8ce
...
...
@@ -132,11 +132,13 @@ type SessionResult struct {
Result
*
irma
.
SignedMessage
}
type
ManualSessionHandler
struct
{
// ManualTestHandler embeds a TestHandler to inherit its methods.
// Below we overwrite the methods that require behaviour specific to manual settings.
type
ManualTestHandler
struct
{
TestHandler
}
func
(
th
*
Manual
S
es
sion
Handler
)
Success
(
result
string
)
{
func
(
th
*
Manual
T
es
t
Handler
)
Success
(
result
string
)
{
if
len
(
result
)
==
0
{
th
.
c
<-
nil
return
...
...
@@ -155,7 +157,7 @@ func (th *ManualSessionHandler) Success(result string) {
Result
:
irmaSignedMessage
,
}
}
func
(
th
*
Manual
S
es
sion
Handler
)
RequestSignaturePermission
(
request
irma
.
SignatureRequest
,
requesterName
string
,
ph
PermissionHandler
)
{
func
(
th
*
Manual
T
es
t
Handler
)
RequestSignaturePermission
(
request
irma
.
SignatureRequest
,
requesterName
string
,
ph
PermissionHandler
)
{
var
attributes
[]
*
irma
.
AttributeIdentifier
for
_
,
cand
:=
range
request
.
Candidates
{
attributes
=
append
(
attributes
,
cand
[
0
])
...
...
@@ -163,14 +165,14 @@ func (th *ManualSessionHandler) RequestSignaturePermission(request irma.Signatur
c
:=
irma
.
DisclosureChoice
{
attributes
}
ph
(
true
,
&
c
)
}
func
(
th
*
Manual
S
es
sion
Handler
)
RequestIssuancePermission
(
request
irma
.
IssuanceRequest
,
issuerName
string
,
ph
PermissionHandler
)
{
func
(
th
*
Manual
T
es
t
Handler
)
RequestIssuancePermission
(
request
irma
.
IssuanceRequest
,
issuerName
string
,
ph
PermissionHandler
)
{
ph
(
true
,
nil
)
}
// These handlers should not be called, fail test if they are called
func
(
th
*
Manual
S
es
sion
Handler
)
RequestSchemeManagerPermission
(
manager
*
irma
.
SchemeManager
,
callback
func
(
proceed
bool
))
{
func
(
th
*
Manual
T
es
t
Handler
)
RequestSchemeManagerPermission
(
manager
*
irma
.
SchemeManager
,
callback
func
(
proceed
bool
))
{
th
.
Failure
(
&
irma
.
SessionError
{
Err
:
errors
.
New
(
"Unexpected session type"
)})
}
func
(
th
*
Manual
S
es
sion
Handler
)
RequestVerificationPermission
(
request
irma
.
DisclosureRequest
,
verifierName
string
,
ph
PermissionHandler
)
{
func
(
th
*
Manual
T
es
t
Handler
)
RequestVerificationPermission
(
request
irma
.
DisclosureRequest
,
verifierName
string
,
ph
PermissionHandler
)
{
th
.
Failure
(
&
irma
.
SessionError
{
Err
:
errors
.
New
(
"Unexpected session type"
)})
}
irmaclient/manual_session_test.go
View file @
94b9d8ce
...
...
@@ -11,9 +11,9 @@ import (
"github.com/stretchr/testify/require"
)
// Create a Manual
S
es
sion
Handler for unit tests
func
createManualSessionHandler
(
t
*
testing
.
T
,
client
*
Client
)
*
Manual
S
es
sion
Handler
{
return
&
Manual
S
es
sion
Handler
{
// Create a Manual
T
es
t
Handler for unit tests
func
createManualSessionHandler
(
t
*
testing
.
T
,
client
*
Client
)
*
Manual
T
es
t
Handler
{
return
&
Manual
T
es
t
Handler
{
TestHandler
:
TestHandler
{
t
:
t
,
c
:
make
(
chan
*
SessionResult
),
...
...
@@ -22,7 +22,7 @@ func createManualSessionHandler(t *testing.T, client *Client) *ManualSessionHand
}
}
func
manualSessionHelper
(
t
*
testing
.
T
,
client
*
Client
,
h
*
Manual
S
es
sion
Handler
,
request
string
,
verifyAs
string
,
corrupt
bool
)
*
irma
.
SignatureProofResult
{
func
manualSessionHelper
(
t
*
testing
.
T
,
client
*
Client
,
h
*
Manual
T
es
t
Handler
,
request
string
,
verifyAs
string
,
corrupt
bool
)
*
irma
.
SignatureProofResult
{
init
:=
client
==
nil
if
init
{
client
=
parseStorage
(
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