From db74680f1c84752c2fc963c1eb0c10c41df69b40 Mon Sep 17 00:00:00 2001 From: Holger <holger@nahrstaedt.de> Date: Fri, 11 Jan 2019 13:58:02 +0100 Subject: [PATCH] Fix more unit tests --- beem/account.py | 32 ++++++++++++++++++++++++-------- beem/comment.py | 16 +++++++++------- tests/beem/test_cli.py | 22 +++++++++++----------- 3 files changed, 44 insertions(+), 26 deletions(-) diff --git a/beem/account.py b/beem/account.py index ddab6dd2..e0e4b99e 100644 --- a/beem/account.py +++ b/beem/account.py @@ -47,7 +47,9 @@ class Account(BlockchainObject): .. code-block:: python >>> from beem.account import Account - >>> account = Account("gtg") + >>> from beem import Steem + >>> stm = Steem("https://steemd.minnowsupportproject.org") + >>> account = Account("gtg", steem_instance=stm) >>> print(account) <Account gtg> >>> print(account.balances) # doctest: +SKIP @@ -607,7 +609,9 @@ class Account(BlockchainObject): .. code-block:: python >>> from beem.account import Account - >>> account = Account("steemit") + >>> from beem import Steem + >>> stm = Steem("https://steemd.minnowsupportproject.org") + >>> account = Account("steemit", steem_instance=stm) >>> account.get_feed(0, 1, raw_data=True) [] @@ -661,7 +665,9 @@ class Account(BlockchainObject): .. code-block:: python >>> from beem.account import Account - >>> account = Account("steemit") + >>> from beem import Steem + >>> stm = Steem("https://steemd.minnowsupportproject.org") + >>> account = Account("steemit", steem_instance=stm) >>> account.get_feed_entries(0, 1) [] @@ -682,7 +688,9 @@ class Account(BlockchainObject): .. code-block:: python >>> from beem.account import Account - >>> account = Account("steemit") + >>> from beem import Steem + >>> stm = Steem("https://steemd.minnowsupportproject.org") + >>> account = Account("steemit", steem_instance=stm) >>> entry = account.get_blog_entries(0, 1, raw_data=True)[0] >>> print("%s - %s - %s - %s" % (entry["author"], entry["permlink"], entry["blog"], entry["reblog_on"])) steemit - firstpost - steemit - 1970-01-01T00:00:00 @@ -704,7 +712,9 @@ class Account(BlockchainObject): .. code-block:: python >>> from beem.account import Account - >>> account = Account("steemit") + >>> from beem import Steem + >>> stm = Steem("https://steemd.minnowsupportproject.org") + >>> account = Account("steemit", steem_instance=stm) >>> account.get_blog(0, 1) [<Comment @steemit/firstpost>] @@ -753,7 +763,9 @@ class Account(BlockchainObject): .. code-block:: python >>> from beem.account import Account - >>> account = Account("steemit") + >>> from beem import Steem + >>> stm = Steem("https://steemd.minnowsupportproject.org") + >>> account = Account("steemit", steem_instance=stm) >>> account.get_blog_authors() [] @@ -1325,7 +1337,9 @@ class Account(BlockchainObject): .. code-block:: python >>> from beem.account import Account - >>> account = Account("beem.app") + >>> from beem import Steem + >>> stm = Steem("https://steemd.minnowsupportproject.org") + >>> account = Account("beem.app", steem_instance=stm) >>> account.get_tags_used_by_author() [] @@ -1381,7 +1395,9 @@ class Account(BlockchainObject): .. code-block:: python >>> from beem.account import Account - >>> account = Account("beem.app") + >>> from beem import Steem + >>> stm = Steem("https://steemd.minnowsupportproject.org") + >>> account = Account("beem.app", steem_instance=stm) >>> account.get_account_votes() [] diff --git a/beem/comment.py b/beem/comment.py index 87aa6ccb..9b640919 100644 --- a/beem/comment.py +++ b/beem/comment.py @@ -33,13 +33,15 @@ class Comment(BlockchainObject): .. code-block:: python - >>> from beem.comment import Comment - >>> from beem.account import Account - >>> acc = Account("gtg") - >>> authorperm = acc.get_blog(limit=1)[0]["authorperm"] - >>> c = Comment(authorperm) - >>> postdate = c["created"] - >>> postdate_str = c.json()["created"] + >>> from beem.comment import Comment + >>> from beem.account import Account + >>> from beem import Steem + >>> stm = Steem("https://steemd.minnowsupportproject.org") + >>> acc = Account("gtg", steem_instance=stm) + >>> authorperm = acc.get_blog(limit=1)[0]["authorperm"] + >>> c = Comment(authorperm) + >>> postdate = c["created"] + >>> postdate_str = c.json()["created"] """ type_id = 8 diff --git a/tests/beem/test_cli.py b/tests/beem/test_cli.py index 890a67d0..b2e7e08a 100644 --- a/tests/beem/test_cli.py +++ b/tests/beem/test_cli.py @@ -152,20 +152,20 @@ class Testcases(unittest.TestCase): def test_upvote(self): runner = CliRunner() - result = runner.invoke(cli, ['-ds', 'upvote', '@test/abcd'], input="test\n") + result = runner.invoke(cli, ['-ds', 'upvote', '@steemit/firstpost'], input="test\n") self.assertEqual(result.exit_code, 0) - result = runner.invoke(cli, ['-ds', 'upvote', '@test/abcd', '100'], input="test\n") + result = runner.invoke(cli, ['-ds', 'upvote', '@steemit/firstpost', '100'], input="test\n") self.assertEqual(result.exit_code, 0) - result = runner.invoke(cli, ['-ds', 'upvote', '--weight', '100', '@test/abcd'], input="test\n") + result = runner.invoke(cli, ['-ds', 'upvote', '--weight', '100', '@steemit/firstpost'], input="test\n") self.assertEqual(result.exit_code, 0) def test_downvote(self): runner = CliRunner() - result = runner.invoke(cli, ['-ds', 'downvote', '@test/abcd'], input="test\n") + result = runner.invoke(cli, ['-ds', 'downvote', '@steemit/firstpost'], input="test\n") self.assertEqual(result.exit_code, 0) - result = runner.invoke(cli, ['-ds', 'downvote', '@test/abcd', '100'], input="test\n") + result = runner.invoke(cli, ['-ds', 'downvote', '@steemit/firstpost', '100'], input="test\n") self.assertEqual(result.exit_code, 0) - result = runner.invoke(cli, ['-ds', 'downvote', '--weight', '100', '@test/abcd'], input="test\n") + result = runner.invoke(cli, ['-ds', 'downvote', '--weight', '100', '@steemit/firstpost'], input="test\n") self.assertEqual(result.exit_code, 0) def test_transfer(self): @@ -319,21 +319,21 @@ class Testcases(unittest.TestCase): def test_resteem(self): runner = CliRunner() - result = runner.invoke(cli, ['-ds', 'resteem', '@test/abcde'], input="test\n") + result = runner.invoke(cli, ['-ds', 'resteem', '@steemit/firstposte'], input="test\n") self.assertEqual(result.exit_code, 0) def test_follow_unfollow(self): runner = CliRunner() - result = runner.invoke(cli, ['-ds', 'follow', 'beem1'], input="test\n") + result = runner.invoke(cli, ['-ds', 'follow', 'beempy'], input="test\n") self.assertEqual(result.exit_code, 0) - result = runner.invoke(cli, ['-ds', 'unfollow', 'beem1'], input="test\n") + result = runner.invoke(cli, ['-ds', 'unfollow', 'beempy'], input="test\n") self.assertEqual(result.exit_code, 0) def test_mute_unmute(self): runner = CliRunner() - result = runner.invoke(cli, ['-ds', 'mute', 'beem1'], input="test\n") + result = runner.invoke(cli, ['-ds', 'mute', 'beempy'], input="test\n") self.assertEqual(result.exit_code, 0) - result = runner.invoke(cli, ['-ds', 'unfollow', 'beem1'], input="test\n") + result = runner.invoke(cli, ['-ds', 'unfollow', 'beempy'], input="test\n") self.assertEqual(result.exit_code, 0) def test_witnesscreate(self): -- GitLab