Example #1
0
 def test_num_retries(self):
     with self.assertRaises(
         NumRetriesReached
     ):
         SteemNodeRPC(urls="https://wrong.link.com", num_retries=2, timeout=1)
     with self.assertRaises(
         NumRetriesReached
     ):
         SteemNodeRPC(urls="https://wrong.link.com", num_retries=3, num_retries_call=3, timeout=1)
     nodes = ["https://httpstat.us/500", "https://httpstat.us/501", "https://httpstat.us/502", "https://httpstat.us/503",
              "https://httpstat.us/505", "https://httpstat.us/511", "https://httpstat.us/520", "https://httpstat.us/522",
              "https://httpstat.us/524"]
     with self.assertRaises(
         NumRetriesReached
     ):
         SteemNodeRPC(urls=nodes, num_retries=0, num_retries_call=0, timeout=1)
Example #2
0
 def setUpClass(cls):
     nodelist = NodeList()
     nodelist.update_nodes(steem_instance=Steem(
         node=nodelist.get_nodes(normal=True, appbase=True), num_retries=3))
     cls.nodes = nodelist.get_nodes(https=False, appbase=False)
     cls.nodes_https = nodelist.get_nodes(wss=False, appbase=False)
     cls.nodes_appbase = nodelist.get_nodes(normal=False)
     cls.test_list = nodelist.get_nodes()
     cls.bts = Steem(node=cls.nodes,
                     nobroadcast=True,
                     keys={
                         "active": wif,
                         "owner": wif,
                         "memo": wif
                     },
                     num_retries=10)
     cls.appbase = Steem(node=cls.nodes_appbase,
                         nobroadcast=True,
                         keys={
                             "active": wif,
                             "owner": wif,
                             "memo": wif
                         },
                         num_retries=10)
     cls.rpc = SteemNodeRPC(urls=cls.test_list)
     # from getpass import getpass
     # self.bts.wallet.unlock(getpass())
     set_shared_steem_instance(cls.bts)
     cls.bts.set_default_account("test")
Example #3
0
 def test_error_handling_appbase(self):
     rpc = SteemNodeRPC(urls=self.nodes_appbase,
                        num_retries=2,
                        num_retries_call=3)
     with self.assertRaises(exceptions.NoMethodWithName):
         rpc.get_wrong_command()
     with self.assertRaises(exceptions.NoApiWithName):
         rpc.get_block({"block_num": 1}, api="wrong_api")
Example #4
0
 def test_connect_test_str_list2(self):
     str_list = ""
     for node in self.nodes:
         str_list += node + ","
     str_list = str_list[:-1]
     rpc = SteemNodeRPC(urls=str_list)
     self.assertIn(rpc.url, self.nodes + self.nodes_appbase + self.nodes_https)
     rpc.next()
     self.assertIn(rpc.url, self.nodes + self.nodes_appbase + self.nodes_https)
Example #5
0
 def test_error_handling(self):
     rpc = SteemNodeRPC(urls=self.nodes, num_retries=2, num_retries_call=3)
     with self.assertRaises(
         exceptions.NoMethodWithName
     ):
         rpc.get_wrong_command()
     with self.assertRaises(
         exceptions.UnhandledRPCError
     ):
         rpc.get_accounts("test")
Example #6
0
 def setUpClass(cls):
     cls.bts = Steem(
         node=nodes,
         nobroadcast=True,
         keys={"active": wif, "owner": wif, "memo": wif},
         num_retries=10
     )
     cls.appbase = Steem(
         node=nodes_appbase,
         nobroadcast=True,
         keys={"active": wif, "owner": wif, "memo": wif},
         num_retries=10
     )
     cls.rpc = SteemNodeRPC(urls=test_list)
     # from getpass import getpass
     # self.bts.wallet.unlock(getpass())
     set_shared_steem_instance(cls.bts)
     cls.bts.set_default_account("test")
Example #7
0
 def test_connect_test_str_list2(self):
     str_list = "wss://steemd.pevo.science, wss://gtg.steem.house:8090, wss://rpc.steemliberator.com, wss://rpc.buildteam.io"
     rpc = SteemNodeRPC(urls=str_list)
     self.assertIn(rpc.url, nodes + nodes_appbase + nodes_https)
     rpc.next()
     self.assertIn(rpc.url, nodes + nodes_appbase + nodes_https)