Commit 4730326a authored by Sietse Ringers's avatar Sietse Ringers
Browse files

Small fixes to unit tests

parent 12c70eaa
...@@ -59,8 +59,9 @@ func (th TestHandler) RequestVerificationPermission(request irma.DisclosureReque ...@@ -59,8 +59,9 @@ func (th TestHandler) RequestVerificationPermission(request irma.DisclosureReque
var candidates []*irma.AttributeIdentifier var candidates []*irma.AttributeIdentifier
for _, disjunction := range request.Content { for _, disjunction := range request.Content {
candidates = th.client.Candidates(disjunction) candidates = th.client.Candidates(disjunction)
require.NotNil(th.t, candidates) if len(candidates) == 0 {
require.NotEmpty(th.t, candidates, 1) th.Failure(irma.ActionUnknown, &irma.SessionError{Err: errors.New("No disclosure candidates found")})
}
choice.Attributes = append(choice.Attributes, candidates[0]) choice.Attributes = append(choice.Attributes, candidates[0])
} }
callback(true, choice) callback(true, choice)
......
...@@ -231,11 +231,8 @@ func TestServiceProvider(t *testing.T) { ...@@ -231,11 +231,8 @@ func TestServiceProvider(t *testing.T) {
}` }`
require.NoError(t, json.Unmarshal([]byte(spjson), &spjwt)) require.NoError(t, json.Unmarshal([]byte(spjson), &spjwt))
require.NotNil(t, spjwt.Request.Request.Content)
require.NotEmpty(t, spjwt.Request.Request.Content) require.NotEmpty(t, spjwt.Request.Request.Content)
require.NotNil(t, spjwt.Request.Request.Content[0])
require.NotEmpty(t, spjwt.Request.Request.Content[0]) require.NotEmpty(t, spjwt.Request.Request.Content[0])
require.NotNil(t, spjwt.Request.Request.Content[0].Attributes)
require.NotEmpty(t, spjwt.Request.Request.Content[0].Attributes) require.NotEmpty(t, spjwt.Request.Request.Content[0].Attributes)
require.Equal(t, spjwt.Request.Request.Content[0].Attributes[0].Name(), "studentID") require.Equal(t, spjwt.Request.Request.Content[0].Attributes[0].Name(), "studentID")
......
Supports Markdown
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