Skip to content

Commit 436fb40

Browse files
committed
Fix Amount in Open Order and improve unittest (Fix bitshares#76)
1 parent 7487190 commit 436fb40

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

bitshares/price.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ def __init__(self, *args, **kwargs):
147147

148148
if "for_sale" in self:
149149
self["for_sale"] = Amount(
150-
self,
151150
{"amount": self["for_sale"], "asset_id": self["base"]["asset"]["id"]},
152151
blockchain_instance=self.blockchain,
153152
)

tests/test_account.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from bitshares.account import Account
77
from bitshares.amount import Amount
88
from bitshares.asset import Asset
9+
from bitshares.price import Order
910
from bitshares.instance import set_shared_bitshares_instance
1011
from bitsharesbase.operationids import getOperationNameForId
1112
from .fixtures import fixture_data, bitshares
@@ -50,8 +51,17 @@ def test_account_upgrade(self):
5051
self.assertEqual(op["account_to_upgrade"], "1.2.100")
5152

5253
def test_openorders(self):
53-
account = Account("init0")
54-
self.assertIsInstance(account.openorders, list)
54+
account = Account("xeroc")
55+
orders = account.openorders
56+
self.assertIsInstance(orders, list)
57+
58+
# If this test fails, it may be that the order expired on-chain!
59+
#
60+
# $ uptick sell 100.000 PORNXXX 100000 BTS --account xeroc
61+
#
62+
for order in orders:
63+
self.assertIsInstance(order, Order)
64+
self.assertEqual(order["for_sale"]["symbol"], "PORNXXX")
5565

5666
def test_calls(self):
5767
account = Account("init0")

0 commit comments

Comments
 (0)