Commit 45250a0d authored by Sietse Ringers's avatar Sietse Ringers
Browse files

Use new irmaserver instad of apiserver for session tests

parent 7e9d3c10
......@@ -15,6 +15,9 @@ func TestMain(m *testing.M) {
test.StartSchemeManagerHttpServer()
defer test.StopSchemeManagerHttpServer()
StartRequestorServer()
defer StopRequestorServer()
test.CreateTestStorage(nil)
defer test.ClearTestStorage(nil)
......
......@@ -14,8 +14,8 @@ import (
"github.com/stretchr/testify/require"
)
func StartRequestorServer(t *testing.T) {
testdata := test.FindTestdataFolder(t)
func StartRequestorServer() {
testdata := test.FindTestdataFolder(nil)
logger := logrus.New()
logger.Level = logrus.WarnLevel
......@@ -30,19 +30,18 @@ func StartRequestorServer(t *testing.T) {
},
Port: 48682,
})
require.NoError(t, err)
if err != nil {
panic("Starting server failed: " + err.Error())
}
}()
time.Sleep(100 * time.Millisecond) // Give server time to start
}
func StopRequestorServer(t *testing.T) {
func StopRequestorServer() {
server.Stop()
}
func serverSessionHelper(t *testing.T, request irma.SessionRequest) *irmaserver.SessionResult {
StartRequestorServer(t)
defer StopRequestorServer(t)
client := parseStorage(t)
defer test.ClearTestStorage(t)
......
......@@ -3,7 +3,6 @@ package sessiontest
import (
"encoding/base64"
"encoding/json"
"fmt"
"testing"
"time"
......@@ -144,14 +143,20 @@ func sessionHelper(t *testing.T, request irma.SessionRequest, url string, client
defer test.ClearTestStorage(t)
}
jwt := getJwt(t, request, url)
url = "http://localhost:8088/irma_api_server/api/v2/" + url
qr, transportErr := startSession(jwt, url)
if transportErr != nil {
fmt.Printf("+%v\n", transportErr)
}
require.NoError(t, transportErr)
qr.URL = url + "/" + qr.URL
transport := irma.NewHTTPTransport("http://localhost:48682")
var qr irma.Qr
err := transport.Post("create", &qr, request)
require.NoError(t, err)
qr.URL = "http://localhost:48682/irma/" + qr.URL
//jwt := getJwt(t, request, url)
//url = "http://localhost:8088/irma_api_server/api/v2/" + url
//qr, transportErr := startSession(jwt, url)
//if transportErr != nil {
// fmt.Printf("+%v\n", transportErr)
//}
//require.NoError(t, transportErr)
//qr.URL = url + "/" + qr.URL
c := make(chan *SessionResult)
h := TestHandler{t, c, client}
......
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