forked from stellar/go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
asset_request_test.go
31 lines (23 loc) · 1.02 KB
/
asset_request_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
package horizonclient
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestAssetRequestBuildUrl(t *testing.T) {
er := AssetRequest{}
endpoint, err := er.BuildURL()
// It should return valid all assets endpoint and no errors
require.NoError(t, err)
assert.Equal(t, "assets", endpoint)
er = AssetRequest{ForAssetIssuer: "GCLWGQPMKXQSPF776IU33AH4PZNOOWNAWGGKVTBQMIC5IMKUNP3E6NVU"}
endpoint, err = er.BuildURL()
// It should return valid assets endpoint and no errors
require.NoError(t, err)
assert.Equal(t, "assets?asset_issuer=GCLWGQPMKXQSPF776IU33AH4PZNOOWNAWGGKVTBQMIC5IMKUNP3E6NVU", endpoint)
er = AssetRequest{ForAssetIssuer: "GCLWGQPMKXQSPF776IU33AH4PZNOOWNAWGGKVTBQMIC5IMKUNP3E6NVU", ForAssetCode: "ABC", Order: OrderDesc}
endpoint, err = er.BuildURL()
// It should return valid assets endpoint and no errors
require.NoError(t, err)
assert.Equal(t, "assets?asset_code=ABC&asset_issuer=GCLWGQPMKXQSPF776IU33AH4PZNOOWNAWGGKVTBQMIC5IMKUNP3E6NVU&order=desc", endpoint)
}