-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathserver_test.go
38 lines (30 loc) · 1007 Bytes
/
server_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package app
import (
"io/ioutil"
"os"
"testing"
"github.com/stretchr/testify/require"
"go.dedis.ch/kyber/v3/suites"
"go.dedis.ch/onet/v3/log"
)
func TestInteractiveConfig(t *testing.T) {
registerService()
defer unregisterService()
tmp, err := ioutil.TempDir("", "conode")
log.ErrFatal(err)
setInput("127.0.0.1:2000\nConode1\n" + tmp)
InteractiveConfig(suites.MustFind("Ed25519"), tmp+"/config.bin")
cc, _, err := ParseCothority(tmp + "/private.toml")
require.NoError(t, err)
require.NotNil(t, cc.Services[testServiceName])
require.Equal(t, cc.Description, "Conode1")
require.Equal(t, cc.Address.String(), "tls://127.0.0.1:2000")
gFile, err := os.Open(tmp + "/public.toml")
require.NoError(t, err)
gc, err := ReadGroupDescToml(gFile)
require.NoError(t, err)
require.Equal(t, 1, len(gc.Roster.List))
require.Equal(t, 1, len(gc.Roster.List[0].ServiceIdentities))
require.Equal(t, "bn256.adapter", gc.Roster.List[0].ServiceIdentities[0].Suite)
log.ErrFatal(os.RemoveAll(tmp))
}