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
68a39ec6
Commit
68a39ec6
authored
Feb 05, 2020
by
Sietse Ringers
Committed by
Sietse Ringers
Feb 05, 2020
Browse files
test: refactor CanVerifyOrSign test
parent
4b4a4d92
Changes
1
Hide whitespace changes
Inline
Side-by-side
server/requestorserver/conf_test.go
View file @
68a39ec6
...
@@ -203,12 +203,13 @@ func TestCanVerifyOrSign(t *testing.T) {
...
@@ -203,12 +203,13 @@ func TestCanVerifyOrSign(t *testing.T) {
},
},
}
}
for
_
,
action
:=
range
[]
string
{
"disclosing"
}
{
for
_
,
action
:=
range
[]
string
{
"disclosing"
,
"signing"
}
{
for
_
,
val
:=
range
disclosingCases
{
for
_
,
val
:=
range
disclosingCases
{
t
.
Run
(
val
.
description
,
func
(
t
*
testing
.
T
)
{
t
.
Run
(
val
.
description
,
func
(
t
*
testing
.
T
)
{
var
conf
Configuration
var
conf
Configuration
require
.
NoError
(
t
,
json
.
Unmarshal
([]
byte
(
confJSON
),
&
conf
))
require
.
NoError
(
t
,
json
.
Unmarshal
([]
byte
(
confJSON
),
&
conf
))
conf
.
Requestors
[
"myapp"
]
.
Disclosing
[
0
]
=
val
.
disclosePerm
conf
.
Requestors
[
"myapp"
]
.
Disclosing
[
0
]
=
val
.
disclosePerm
conf
.
Requestors
[
"myapp"
]
.
Signing
[
0
]
=
val
.
disclosePerm
requestedAttributes
:=
createAttributesConDisCon
(
val
.
attributeConDisCon
)
requestedAttributes
:=
createAttributesConDisCon
(
val
.
attributeConDisCon
)
result
,
message
:=
conf
.
CanVerifyOrSign
(
val
.
requestorName
,
irma
.
Action
(
action
),
requestedAttributes
)
result
,
message
:=
conf
.
CanVerifyOrSign
(
val
.
requestorName
,
irma
.
Action
(
action
),
requestedAttributes
)
...
@@ -217,17 +218,4 @@ func TestCanVerifyOrSign(t *testing.T) {
...
@@ -217,17 +218,4 @@ func TestCanVerifyOrSign(t *testing.T) {
})
})
}
}
}
}
for
_
,
val
:=
range
disclosingCases
{
t
.
Run
(
val
.
description
,
func
(
t
*
testing
.
T
)
{
var
conf
Configuration
require
.
NoError
(
t
,
json
.
Unmarshal
([]
byte
(
confJSON
),
&
conf
))
conf
.
Requestors
[
"myapp"
]
.
Signing
[
0
]
=
val
.
disclosePerm
requestedAttributes
:=
createAttributesConDisCon
(
val
.
attributeConDisCon
)
result
,
message
:=
conf
.
CanVerifyOrSign
(
val
.
requestorName
,
irma
.
Action
(
"signing"
),
requestedAttributes
)
require
.
Equal
(
t
,
val
.
result
,
result
)
require
.
Equal
(
t
,
val
.
message
,
message
)
})
}
}
}
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