Skip to content

Commit

Permalink
Unittest Asset
Browse files Browse the repository at this point in the history
  • Loading branch information
xeroc committed Dec 11, 2018
1 parent 11fd5cb commit 8610ab5
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tests/test_asset.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,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"])

0 comments on commit 8610ab5

Please sign in to comment.