Commit 3b430193 authored by Sietse Ringers's avatar Sietse Ringers
Browse files

Fix unit tests

parent d45627be
...@@ -4,10 +4,11 @@ import ( ...@@ -4,10 +4,11 @@ import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"testing"
"github.com/go-errors/errors" "github.com/go-errors/errors"
"github.com/privacybydesign/irmago" "github.com/privacybydesign/irmago"
"github.com/privacybydesign/irmago/internal/test" "github.com/privacybydesign/irmago/internal/test"
"testing"
) )
type ManualSessionHandler struct { type ManualSessionHandler struct {
...@@ -205,7 +206,7 @@ func TestManualSessionInvalidAttributeValue(t *testing.T) { ...@@ -205,7 +206,7 @@ func TestManualSessionInvalidAttributeValue(t *testing.T) {
func TestManualKeyShareSession(t *testing.T) { func TestManualKeyShareSession(t *testing.T) {
invalidate = false invalidate = false
request := "{\"nonce\": 0, \"context\": 0, \"message\":\"I owe you everything\",\"messageType\":\"STRING\",\"content\":[{\"label\":\"Student number (RU)\",\"attributes\":[\"test.test.mijnirma.email\"]}]}" request := "{\"nonce\": 0, \"context\": 0, \"message\":\"I owe you everything\",\"messageType\":\"STRING\",\"content\":[{\"label\":\"Student number (RU)\",\"attributes\":[\"test.test.mijnirma.username\"]}]}"
ms := createManualSessionHandler(request, request, t) ms := createManualSessionHandler(request, request, t)
......
...@@ -3,7 +3,6 @@ package irmaclient ...@@ -3,7 +3,6 @@ package irmaclient
import ( import (
"crypto/rand" "crypto/rand"
"encoding/base64" "encoding/base64"
"encoding/hex"
"encoding/json" "encoding/json"
"fmt" "fmt"
"testing" "testing"
...@@ -300,7 +299,7 @@ func keyshareSessions(t *testing.T, client *Client) { ...@@ -300,7 +299,7 @@ func keyshareSessions(t *testing.T, client *Client) {
&irma.CredentialRequest{ &irma.CredentialRequest{
Validity: &expiry, Validity: &expiry,
CredentialTypeID: &credid, CredentialTypeID: &credid,
Attributes: map[string]string{"email": "example@example.com"}, Attributes: map[string]string{"username": "testusername"},
}, },
) )
sessionHelper(t, jwt, "issue", client) sessionHelper(t, jwt, "issue", client)
...@@ -310,7 +309,7 @@ func keyshareSessions(t *testing.T, client *Client) { ...@@ -310,7 +309,7 @@ func keyshareSessions(t *testing.T, client *Client) {
jwt.(*irma.ServiceProviderJwt).Request.Request.Content, jwt.(*irma.ServiceProviderJwt).Request.Request.Content,
&irma.AttributeDisjunction{ &irma.AttributeDisjunction{
Label: "foo", Label: "foo",
Attributes: []irma.AttributeTypeIdentifier{irma.NewAttributeTypeIdentifier("test.test.mijnirma.email")}, Attributes: []irma.AttributeTypeIdentifier{irma.NewAttributeTypeIdentifier("test.test.mijnirma.username")},
}, },
) )
sessionHelper(t, jwt, "verification", client) sessionHelper(t, jwt, "verification", client)
...@@ -320,7 +319,7 @@ func keyshareSessions(t *testing.T, client *Client) { ...@@ -320,7 +319,7 @@ func keyshareSessions(t *testing.T, client *Client) {
jwt.(*irma.SignatureRequestorJwt).Request.Request.Content, jwt.(*irma.SignatureRequestorJwt).Request.Request.Content,
&irma.AttributeDisjunction{ &irma.AttributeDisjunction{
Label: "foo", Label: "foo",
Attributes: []irma.AttributeTypeIdentifier{irma.NewAttributeTypeIdentifier("test.test.mijnirma.email")}, Attributes: []irma.AttributeTypeIdentifier{irma.NewAttributeTypeIdentifier("test.test.mijnirma.username")},
}, },
) )
sessionHelper(t, jwt, "signature", client) sessionHelper(t, jwt, "signature", client)
...@@ -343,8 +342,7 @@ func TestKeyshareEnrollmentAndSessions(t *testing.T) { ...@@ -343,8 +342,7 @@ func TestKeyshareEnrollmentAndSessions(t *testing.T) {
client.handler.(*TestClientHandler).c = c client.handler.(*TestClientHandler).c = c
bytes := make([]byte, 8, 8) bytes := make([]byte, 8, 8)
rand.Read(bytes) rand.Read(bytes)
email := fmt.Sprintf("%s@example.com", hex.EncodeToString(bytes)) require.NoError(t, client.keyshareEnrollWorker(irma.NewSchemeManagerIdentifier("test"), nil, "12345"))
require.NoError(t, client.keyshareEnrollWorker(irma.NewSchemeManagerIdentifier("test"), email, "12345"))
if err := <-c; err != nil { if err := <-c; err != nil {
t.Fatal(err) t.Fatal(err)
} }
......
...@@ -11,6 +11,6 @@ ...@@ -11,6 +11,6 @@
</Description> </Description>
<KeyshareServer>http://localhost:8080/irma_keyshare_server/api/v1</KeyshareServer> <KeyshareServer>http://localhost:8080/irma_keyshare_server/api/v1</KeyshareServer>
<KeyshareWebsite>http://localhost:8080/irma_keyshare_server/mijnirma/</KeyshareWebsite> <KeyshareWebsite>http://localhost:8080/irma_keyshare_server/mijnirma/</KeyshareWebsite>
<KeyshareAttribute>test.test.mijnirma.email</KeyshareAttribute> <KeyshareAttribute>test.test.mijnirma.username</KeyshareAttribute>
<Contact>https://privacybydesign.foundation/</Contact> <Contact>https://privacybydesign.foundation/</Contact>
</SchemeManager> </SchemeManager>
c01fb73d8b9f3ae1e530f6335bbb1857d67d5022c5c25e5188f0dd9e0f688707 test/description.xml e1cb76b0730accb0e14de21a6cf85a2e3a5ba5c47808f648168c17536f971173 test/description.xml
61aa81ab57c7e4812955d77e00aeb0afefa4c88a90bee5cd75fe9aaea9d4effb test/test/Issues/email/description.xml 61aa81ab57c7e4812955d77e00aeb0afefa4c88a90bee5cd75fe9aaea9d4effb test/test/Issues/email/description.xml
61a1fc7f161e43f8fc5b0c6ac2997cfe6bc0da7d27009b9914a04dca79ec6718 test/test/Issues/email/logo.png 61a1fc7f161e43f8fc5b0c6ac2997cfe6bc0da7d27009b9914a04dca79ec6718 test/test/Issues/email/logo.png
c385a1e6f2cf201161af968c92b8ffdfe5a061e001b51217a41b9277aab817de test/test/Issues/mijnirma/description.xml c385a1e6f2cf201161af968c92b8ffdfe5a061e001b51217a41b9277aab817de test/test/Issues/mijnirma/description.xml
......
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