-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnfttoken_test.go
47 lines (42 loc) · 966 Bytes
/
nfttoken_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
package crownd
import (
"errors"
"os"
"testing"
)
func loadTestEnvVars() (string, string, error) {
ruser := os.Getenv("RPC_USER")
if ruser == "" {
return "", "", errors.New("error reading enviroment var RPC_USER")
}
rpass := os.Getenv("RPC_PASS")
if rpass == "" {
return "", "", errors.New("error reading enviroment var RPC_PASS")
}
return ruser, rpass, nil
}
func TestGetNFToken(t *testing.T) {
ruser, rpass, err := loadTestEnvVars()
if err != nil {
t.Fatal(err)
}
c, err := NewClient("localhost", 9341, ruser, rpass, 5000)
if err != nil {
t.Fatal(err)
}
protocolId := "testperiod"
tokenId := "612d637bddcdd31467b5c44812f053d7faa30c8f740912fe5d02ff784ef1a9ff"
nft, err2 := c.GetNFToken(protocolId, tokenId)
if err2 != nil {
t.Fatal(err)
}
if nft == nil {
t.Fatal("nft is nil")
}
if nft.ID != tokenId {
t.Fatal("nft.ID != tokenId")
}
if nft.NFTProtocolID != protocolId {
t.Fatal("nft.NFTProtocolID != protocolId")
}
}