-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathaccount_test.go
57 lines (42 loc) · 1.31 KB
/
account_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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package substrate
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestAddress(t *testing.T) {
require := require.New(t)
account, err := FromAddress(AliceAddress)
require.NoError(err)
require.Equal(AliceAddress, account.String())
}
func TestGetAccountByAddress(t *testing.T) {
cl := startLocalConnection(t)
defer cl.Close()
require := require.New(t)
account, err := FromAddress(AliceAddress)
require.NoError(err)
_, err = cl.GetAccountPublicInfo(account)
require.NoError(err)
}
func TestGetBalance(t *testing.T) {
cl := startLocalConnection(t)
defer cl.Close()
require := require.New(t)
account, err := FromAddress(AliceAddress)
require.NoError(err)
_, err = cl.GetBalance(account)
require.NoError(err)
}
func TestEnsureAccountWithDownActivationService(t *testing.T) {
cl := startLocalConnection(t)
defer cl.Close()
require := require.New(t)
id, err := NewIdentityFromEd25519Phrase("paper endless radio rude wage hood cabin praise girl income chief craft")
require.NoError(err)
_, err = cl.EnsureAccount(id, "https://test.wrong-activation-service-url.tf", "test", "test")
require.Error(err)
require.IsType(ActivationServiceError{}, err)
_, err = cl.EnsureAccount(id, "https://httpstat.us/503", "test", "test")
require.Error(err)
require.IsType(ActivationServiceError{}, err)
}