forked from bitshares/python-bitshares
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_asset.py
More file actions
35 lines (29 loc) · 1.23 KB
/
Copy pathtest_asset.py
File metadata and controls
35 lines (29 loc) · 1.23 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
import unittest
from bitshares import BitShares
from bitshares.asset import Asset
from bitshares.instance import set_shared_bitshares_instance
from bitshares.exceptions import AssetDoesNotExistsException
from .fixtures import fixture_data
class Testcases(unittest.TestCase):
def setUp(self):
fixture_data()
def test_assert(self):
with self.assertRaises(AssetDoesNotExistsException):
Asset("FOObarNonExisting", full=False)
def test_refresh(self):
asset = Asset("1.3.0", full=False)
asset.ensure_full()
self.assertIn("dynamic_asset_data", asset)
self.assertIn("flags", asset)
self.assertIn("permissions", asset)
self.assertIsInstance(asset["flags"], dict)
self.assertIsInstance(asset["permissions"], dict)
def test_properties(self):
asset = Asset("1.3.0", full=False)
self.assertIsInstance(asset.symbol, str)
self.assertIsInstance(asset.precision, int)
self.assertIsInstance(asset.is_bitasset, bool)
self.assertIsInstance(asset.permissions, dict)
self.assertEqual(asset.permissions, asset["permissions"])
self.assertIsInstance(asset.flags, dict)
self.assertEqual(asset.flags, asset["flags"])