Skip to content
Snippets Groups Projects
Commit 5af48705 authored by Holger's avatar Holger
Browse files

Fix unit tests

parent be6461dc
No related branches found
No related tags found
No related merge requests found
...@@ -599,6 +599,8 @@ class Comment(BlockchainObject): ...@@ -599,6 +599,8 @@ class Comment(BlockchainObject):
:param str voter: (optional) Voting account :param str voter: (optional) Voting account
""" """
if weight < 0:
raise ValueError("Weight must be >= 0.")
last_payout = self.get('last_payout', None) last_payout = self.get('last_payout', None)
if last_payout is not None: if last_payout is not None:
if formatToTimeStamp(last_payout) > 0: if formatToTimeStamp(last_payout) > 0:
...@@ -613,6 +615,8 @@ class Comment(BlockchainObject): ...@@ -613,6 +615,8 @@ class Comment(BlockchainObject):
:param str voter: (optional) Voting account :param str voter: (optional) Voting account
""" """
if weight < 0:
raise ValueError("Weight must be >= 0.")
last_payout = self.get('last_payout', None) last_payout = self.get('last_payout', None)
if last_payout is not None: if last_payout is not None:
if formatToTimeStamp(last_payout) > 0: if formatToTimeStamp(last_payout) > 0:
......
...@@ -134,12 +134,13 @@ class Testcases(unittest.TestCase): ...@@ -134,12 +134,13 @@ class Testcases(unittest.TestCase):
tx = c.upvote(weight=99.9, voter="test") tx = c.upvote(weight=99.9, voter="test")
op = tx["operations"][0][1] op = tx["operations"][0][1]
self.assertEqual(op["weight"], 9990) self.assertEqual(op["weight"], 9990)
c.steem.txbuffer.clear() c.steem.txbuffer.clear()
tx = c.downvote(weight=-150, voter="test") tx = c.downvote(weight=150, voter="test")
op = tx["operations"][0][1] op = tx["operations"][0][1]
self.assertEqual(op["weight"], -10000) self.assertEqual(op["weight"], -10000)
c.steem.txbuffer.clear() c.steem.txbuffer.clear()
tx = c.downvote(weight=-99.9, voter="test") tx = c.downvote(weight=99.9, voter="test")
op = tx["operations"][0][1] op = tx["operations"][0][1]
self.assertEqual(op["weight"], -9990) self.assertEqual(op["weight"], -9990)
......
...@@ -24,7 +24,7 @@ class Testcases(unittest.TestCase): ...@@ -24,7 +24,7 @@ class Testcases(unittest.TestCase):
def test_get_nodes(self): def test_get_nodes(self):
nodelist = NodeList() nodelist = NodeList()
all_nodes = nodelist.get_nodes(exclude_limited=False, dev=True, testnet=True, testnetdev=True) all_nodes = nodelist.get_nodes(exclude_limited=False, dev=True, testnet=True, testnetdev=True)
self.assertEqual(len(nodelist) - 15, len(all_nodes)) self.assertEqual(len(nodelist) - 22, len(all_nodes))
https_nodes = nodelist.get_nodes(wss=False) https_nodes = nodelist.get_nodes(wss=False)
self.assertEqual(https_nodes[0][:5], 'https') self.assertEqual(https_nodes[0][:5], 'https')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment