main_test.go 804 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
package sessiontest

import (
	"os"
	"path/filepath"
	"testing"

	"github.com/privacybydesign/irmago/internal/test"
	"github.com/privacybydesign/irmago/irmaclient"
	"github.com/stretchr/testify/require"
)

func TestMain(m *testing.M) {
	// Create HTTP server for scheme managers
	test.StartSchemeManagerHttpServer()
16
	defer test.StopSchemeManagerHttpServer()
17

18
	StartIrmaJwtServer()
Sietse Ringers's avatar
Sietse Ringers committed
19
	defer StopIrmaServer()
20

21
	test.CreateTestStorage(nil)
22
	defer test.ClearTestStorage(nil)
23

24
	os.Exit(m.Run())
25
26
27
}

func parseStorage(t *testing.T) *irmaclient.Client {
28
	test.SetupTestStorage(t)
29
30
31
32
33
34
35
36
37
38
	path := test.FindTestdataFolder(t)
	client, err := irmaclient.New(
		filepath.Join(path, "storage", "test"),
		filepath.Join(path, "irma_configuration"),
		"",
		&TestClientHandler{t: t},
	)
	require.NoError(t, err)
	return client
}