FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-bitshares/tests/test_txbuffers.py at develop · mikakoi/python-bitshares · GitHub
mikakoi
/
python-bitshares
Public
forked from
bitshares/python-bitshares
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
python-bitshares
/
tests
/
test_txbuffers.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
107 lines (94 loc) · 3.51 KB
Breadcrumbs
python-bitshares
/
tests
/
test_txbuffers.py
Copy path
File metadata and controls
107 lines (94 loc) · 3.51 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
import
unittest
from
bitshares
import
BitShares
from
bitsharesbase
import
operations
from
bitshares
.
instance
import
set_shared_bitshares_instance
wif
=
"5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"
class
Testcases
(
unittest
.
TestCase
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
().
__init__
(
*
args
,
**
kwargs
)
self
.
bts
=
BitShares
(
"wss://node.testnet.bitshares.eu"
,
nobroadcast
=
True
,
keys
=
{
"active"
:
wif
}
)
set_shared_bitshares_instance
(
self
.
bts
)
self
.
bts
.
set_default_account
(
"init0"
)
def
test_add_one_proposal_one_op
(
self
):
bts
=
self
.
bts
tx1
=
bts
.
new_tx
()
proposal1
=
bts
.
new_proposal
(
tx1
,
proposer
=
"init0"
)
op
=
operations
.
Transfer
(
**
{
"fee"
: {
"amount"
:
0
,
"asset_id"
:
"1.3.0"
},
"from"
:
"1.2.0"
,
"to"
:
"1.2.0"
,
"amount"
: {
"amount"
:
0
,
"asset_id"
:
"1.3.0"
},
"prefix"
:
"TEST"
})
proposal1
.
appendOps
(
op
)
tx
=
tx1
.
json
()
self
.
assertEqual
(
tx
[
"operations"
][
0
][
0
],
22
)
self
.
assertEqual
(
len
(
tx
[
"operations"
]),
1
)
ps
=
tx
[
"operations"
][
0
][
1
]
self
.
assertEqual
(
len
(
ps
[
"proposed_ops"
]),
1
)
self
.
assertEqual
(
ps
[
"proposed_ops"
][
0
][
"op"
][
0
],
0
)
def
test_add_one_proposal_two_ops
(
self
):
bts
=
self
.
bts
tx1
=
bts
.
new_tx
()
proposal1
=
bts
.
new_proposal
(
tx1
,
proposer
=
"init0"
)
op
=
operations
.
Transfer
(
**
{
"fee"
: {
"amount"
:
0
,
"asset_id"
:
"1.3.0"
},
"from"
:
"1.2.0"
,
"to"
:
"1.2.0"
,
"amount"
: {
"amount"
:
0
,
"asset_id"
:
"1.3.0"
},
"prefix"
:
"TEST"
})
proposal1
.
appendOps
(
op
)
proposal1
.
appendOps
(
op
)
tx
=
tx1
.
json
()
self
.
assertEqual
(
tx
[
"operations"
][
0
][
0
],
22
)
self
.
assertEqual
(
len
(
tx
[
"operations"
]),
1
)
ps
=
tx
[
"operations"
][
0
][
1
]
self
.
assertEqual
(
len
(
ps
[
"proposed_ops"
]),
2
)
self
.
assertEqual
(
ps
[
"proposed_ops"
][
0
][
"op"
][
0
],
0
)
self
.
assertEqual
(
ps
[
"proposed_ops"
][
1
][
"op"
][
0
],
0
)
def
test_have_two_proposals
(
self
):
bts
=
self
.
bts
tx1
=
bts
.
new_tx
()
# Proposal 1
proposal1
=
bts
.
new_proposal
(
tx1
,
proposer
=
"init0"
)
op
=
operations
.
Transfer
(
**
{
"fee"
: {
"amount"
:
0
,
"asset_id"
:
"1.3.0"
},
"from"
:
"1.2.0"
,
"to"
:
"1.2.0"
,
"amount"
: {
"amount"
:
0
,
"asset_id"
:
"1.3.0"
},
"prefix"
:
"TEST"
})
for
i
in
range
(
0
,
3
):
proposal1
.
appendOps
(
op
)
# Proposal 1
proposal2
=
bts
.
new_proposal
(
tx1
,
proposer
=
"init0"
)
op
=
operations
.
Transfer
(
**
{
"fee"
: {
"amount"
:
0
,
"asset_id"
:
"1.3.0"
},
"from"
:
"1.2.0"
,
"to"
:
"1.2.0"
,
"amount"
: {
"amount"
:
5555555
,
"asset_id"
:
"1.3.0"
},
"prefix"
:
"TEST"
})
for
i
in
range
(
0
,
2
):
proposal2
.
appendOps
(
op
)
tx
=
tx1
.
json
()
self
.
assertEqual
(
len
(
tx
[
"operations"
]),
2
)
# 2 proposals
# Test proposal 1
prop
=
tx
[
"operations"
][
0
]
self
.
assertEqual
(
prop
[
0
],
22
)
ps
=
prop
[
1
]
self
.
assertEqual
(
len
(
ps
[
"proposed_ops"
]),
3
)
for
i
in
range
(
0
,
3
):
self
.
assertEqual
(
ps
[
"proposed_ops"
][
i
][
"op"
][
0
],
0
)
# Test proposal 2
prop
=
tx
[
"operations"
][
1
]
self
.
assertEqual
(
prop
[
0
],
22
)
ps
=
prop
[
1
]
self
.
assertEqual
(
len
(
ps
[
"proposed_ops"
]),
2
)
for
i
in
range
(
0
,
2
):
self
.
assertEqual
(
ps
[
"proposed_ops"
][
i
][
"op"
][
0
],
0
)
Back
|
FazBrowse Home
|
New Git URL