-
Notifications
You must be signed in to change notification settings - Fork 173
Expand file tree
/
Copy pathproposal_test.go
More file actions
56 lines (48 loc) · 1.38 KB
/
proposal_test.go
File metadata and controls
56 lines (48 loc) · 1.38 KB
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
package cli_test
import (
"os"
"path"
"testing"
"github.com/stretchr/testify/require"
umeeapp "github.com/umee-network/umee/v2/app"
"github.com/umee-network/umee/v2/x/leverage/client/cli"
)
func TestParseUpdateRegistryProposal(t *testing.T) {
encCfg := umeeapp.MakeEncodingConfig()
tmpDir := t.TempDir()
// create a bogus proposal file and ensure parsing fails
filePath := path.Join(tmpDir, "bad_proposal.json")
bz := []byte(`
foo
`)
os.WriteFile(filePath, bz, 0o644)
_, err := cli.ParseUpdateRegistryProposal(encCfg.Marshaler, filePath)
require.Error(t, err)
// create a good proposal file and ensure parsing does not fail
filePath = path.Join(tmpDir, "good_proposal.json")
bz = []byte(`{
"title": "Update the Leverage Token Registry",
"description": "Replace the supported tokens in the leverage registry.",
"registry": [
{
"base_denom": "uumee",
"reserve_factor": "0.1",
"collateral_weight": "0.05",
"liquidation_threshold": "0.05",
"base_borrow_rate": "0.02",
"kink_borrow_rate": "0.2",
"max_borrow_rate": "1.5",
"kink_utilization_rate": "0.2",
"liquidation_incentive": "0.1",
"symbol_denom": "UMEE",
"exponent": 6,
"enable_msg_lend": true,
"enable_msg_borrow": true,
"blacklist": false
}
]
}`)
os.WriteFile(filePath, bz, 0o644)
_, err = cli.ParseUpdateRegistryProposal(encCfg.Marshaler, filePath)
require.NoError(t, err)
}