forked from jeffwalsh/go-coinpayments
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconvert_test.go
52 lines (43 loc) · 933 Bytes
/
convert_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
package coinpayments_test
import (
"net/http"
"os"
"testing"
"time"
"github.com/tryvium-travels/go-coinpayments"
)
func TestCallGetConversionLimits(t *testing.T) {
pub, ok := os.LookupEnv("COINPAYMENTS_PUBLIC_KEY")
if !ok {
t.Fatal("no public key provided in environment")
}
priv, ok := os.LookupEnv("COINPAYMENTS_PRIVATE_KEY")
if !ok {
t.Fatal("no privatekey provided in environment")
}
cfg := &coinpayments.Config{
PrivateKey: priv,
PublicKey: pub,
}
hc := &http.Client{Timeout: time.Minute * 1}
client, err := coinpayments.NewClient(cfg, hc)
if err != nil {
t.Fatal(err)
}
req1 := coinpayments.ConvertLimitRequest{
From: "ETH",
To: "BTC",
}
req2 := coinpayments.ConvertLimitRequest{
From: "BTC",
To: "ETH",
}
_, err = client.CallGetConversionLimits(&req1)
if err != nil {
t.Error(err)
}
_, err = client.CallGetConversionLimits(&req2)
if err != nil {
t.Fatal(err)
}
}