Commit 68a39ec6 authored by Sietse Ringers's avatar Sietse Ringers Committed by Sietse Ringers
Browse files

test: refactor CanVerifyOrSign test

parent 4b4a4d92
...@@ -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)
})
}
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment