github.com/bitfinexcom/bitfinex-api-go@v0.0.0-20210608095005-9e0b26f200fb/v1/deposit_test.go (about)

     1  package bitfinex
     2  
     3  import (
     4  	"bytes"
     5  	"io/ioutil"
     6  	"net/http"
     7  	"testing"
     8  )
     9  
    10  func TestDepositNew(t *testing.T) {
    11  	httpDo = func(req *http.Request) (*http.Response, error) {
    12  		msg := `{
    13              "result":"success",
    14              "method":"bitcoin",
    15              "currency":"BTC",
    16              "address":"1A2wyHKJ4KWEoahDHVxwQy3kdd6g1qiSYV"
    17          }`
    18  		resp := http.Response{
    19  			Body:       ioutil.NopCloser(bytes.NewBufferString(msg)),
    20  			StatusCode: 200,
    21  		}
    22  		return &resp, nil
    23  	}
    24  
    25  	deposit, err := NewClient().Deposit.New("bitcoin", "trading", 0)
    26  
    27  	if err != nil {
    28  		t.Error(err)
    29  	}
    30  	success, err := deposit.Success()
    31  
    32  	if err != nil || !success {
    33  		t.Error("Expected", true)
    34  		t.Error("Actual ", success)
    35  		t.Error("With message", err)
    36  	}
    37  }