From 4ed70821fb6066758061351ed43804dcd620d6aa Mon Sep 17 00:00:00 2001
From: Holger <holger@nahrstaedt.de>
Date: Tue, 9 Oct 2018 22:11:26 +0200
Subject: [PATCH] Fix unit tests

---
 tests/beem/test_blockchain.py  | 55 +++++++---------------------------
 tests/beem/test_cli.py         |  2 +-
 tests/beem/test_discussions.py |  8 +----
 3 files changed, 12 insertions(+), 53 deletions(-)

diff --git a/tests/beem/test_blockchain.py b/tests/beem/test_blockchain.py
index a3b9cea5..fc70772d 100644
--- a/tests/beem/test_blockchain.py
+++ b/tests/beem/test_blockchain.py
@@ -52,15 +52,8 @@ class Testcases(unittest.TestCase):
         cls.start_testnet = num - 25
         cls.stop_testnet = num
 
-    @parameterized.expand([
-        ("normal"),
-        ("testnet"),
-    ])
-    def test_blockchain(self, node_param):
-        if node_param == "normal":
-            bts = self.bts
-        else:
-            bts = self.testnet
+    def test_blockchain(self):
+        bts = self.bts
         b = Blockchain(steem_instance=bts)
         num = b.get_current_block_num()
         self.assertTrue(num > 0)
@@ -74,15 +67,8 @@ class Testcases(unittest.TestCase):
         timestamp = int(time.mktime(block.time().timetuple()))
         self.assertEqual(block_timestamp, timestamp)
 
-    @parameterized.expand([
-        ("normal"),
-        ("testnet"),
-    ])
-    def test_estimate_block_num(self, node_param):
-        if node_param == "normal":
-            bts = self.bts
-        else:
-            bts = self.testnet
+    def test_estimate_block_num(self):
+        bts = self.bts
         b = Blockchain(steem_instance=bts)
         last_block = b.get_current_block()
         num = last_block.identifier
@@ -96,15 +82,8 @@ class Testcases(unittest.TestCase):
         self.assertTrue((est_block_num - (old_block.identifier)) < 2)
         est_block_num = b.get_estimated_block_num(date, estimateForwards=True, accurate=False)
 
-    @parameterized.expand([
-        ("normal"),
-        ("testnet"),
-    ])
-    def test_get_all_accounts(self, node_param):
-        if node_param == "normal":
-            bts = self.bts
-        else:
-            bts = self.testnet
+    def test_get_all_accounts(self):
+        bts = self.bts
         b = Blockchain(steem_instance=bts)
         accounts = []
         limit = 200
@@ -226,15 +205,8 @@ class Testcases(unittest.TestCase):
             break
         self.assertTrue(len(ops_blocks) == 1)
 
-    @parameterized.expand([
-        ("normal"),
-        ("testnet"),
-    ])
-    def test_stream2(self, node_param):
-        if node_param == "normal":
-            bts = self.bts
-        else:
-            bts = self.testnet
+    def test_stream2(self):
+        bts = self.bts
         b = Blockchain(steem_instance=bts)
         stop_block = b.get_current_block_num()
         start_block = stop_block - 10
@@ -243,15 +215,8 @@ class Testcases(unittest.TestCase):
             ops_stream.append(op)
         self.assertTrue(len(ops_stream) > 0)
 
-    @parameterized.expand([
-        ("normal"),
-        ("testnet"),
-    ])
-    def test_wait_for_and_get_block(self, node_param):
-        if node_param == "normal":
-            bts = self.bts
-        else:
-            bts = self.testnet
+    def test_wait_for_and_get_block(self):
+        bts = self.bts
         b = Blockchain(steem_instance=bts, max_block_wait_repetition=18)
         start_num = b.get_current_block_num()
         blocknum = start_num
diff --git a/tests/beem/test_cli.py b/tests/beem/test_cli.py
index ad4fbef3..840b7965 100644
--- a/tests/beem/test_cli.py
+++ b/tests/beem/test_cli.py
@@ -274,7 +274,7 @@ class Testcases(unittest.TestCase):
         runner.invoke(cli, ['-o', 'set', 'nodes', str(self.nodelist.get_testnet())])
         result = runner.invoke(cli, ['-d', 'newaccount', 'beem3'], input="test\ntest\ntest\n")
         self.assertEqual(result.exit_code, 0)
-        result = runner.invoke(cli, ['-d', 'newaccount', '--fee', '6 STEEM', 'beem3'], input="test\ntest\ntest\n")
+        result = runner.invoke(cli, ['-d', 'newaccount', 'beem3'], input="test\ntest\ntest\n")
         self.assertEqual(result.exit_code, 0)
 
     def test_importaccount(self):
diff --git a/tests/beem/test_discussions.py b/tests/beem/test_discussions.py
index 9e2f8cec..dec8b690 100644
--- a/tests/beem/test_discussions.py
+++ b/tests/beem/test_discussions.py
@@ -33,12 +33,6 @@ class Testcases(unittest.TestCase):
             keys={"active": wif},
             num_retries=10
         )
-        cls.testnet = Steem(
-            node="https://testnet.steemitdev.com",
-            nobroadcast=True,
-            keys={"active": wif},
-            num_retries=10
-        )
         # from getpass import getpass
         # self.bts.wallet.unlock(getpass())
         set_shared_steem_instance(cls.bts)
@@ -86,7 +80,7 @@ class Testcases(unittest.TestCase):
         self.assertEqual(len(d), 10)
 
     def test_cashout(self):
-        bts = self.testnet
+        bts = self.bts
         query = Query(limit=10)
         Discussions_by_cashout(query, steem_instance=bts)
         # self.assertEqual(len(d), 10)
-- 
GitLab