def test_invalid_cancel_1(self):
     self.assertIsInstance(xbridge_client.CHECK_CANCEL_TX(" "), dict)
     self.assertIsInstance(xbridge_client.CHECK_CANCEL_TX(""), dict)
     self.assertIsInstance(xbridge_client.CHECK_CANCEL_TX("[]"), dict)
     self.assertIsInstance(xbridge_client.CHECK_CANCEL_TX("[[]]"), dict)
     self.assertIsInstance(xbridge_client.CHECK_CANCEL_TX("{{}}"), dict)
     self.assertIsInstance(xbridge_client.CHECK_CANCEL_TX("{[]}"), dict)
     self.assertIsInstance(xbridge_client.CHECK_CANCEL_TX("[{[]}]"), dict)
     self.assertIsInstance(xbridge_client.CHECK_CANCEL_TX("''"), dict)
     self.assertIsInstance(xbridge_client.CHECK_CANCEL_TX("'"), dict)
def defined_seq_market_actions_api_calls(nb_of_runs):
    time_distribution = []
    total_elapsed_seconds = 0
    for i in range(1, nb_of_runs):
        xbridge_utils.generate_new_set_of_data()
        func_str = ""
        ts = time.time()
        if i % 3 == 0:
            xbridge_client.CHECK_CREATE_TX(xbridge_utils.c_src_Address,
                                           xbridge_utils.c_src_Token,
                                           xbridge_utils.source_nb,
                                           xbridge_utils.c_dest_Address,
                                           xbridge_utils.c_dest_Token,
                                           xbridge_utils.dest_nb)
            func_str = "CHECK_CREATE_TX"
        if i % 3 == 1:
            xbridge_client.CHECK_ACCEPT_TX(xbridge_utils.a_random_tx_id,
                                           xbridge_utils.a_src_Address,
                                           xbridge_utils.a_dest_Address)
            func_str = "CHECK_ACCEPT_TX"
        if i % 3 == 2:
            xbridge_client.CHECK_CANCEL_TX(xbridge_utils.ca_random_tx_id)
            func_str = "CHECK_CANCEL_TX"
        te = time.time()
        total_elapsed_seconds += te - ts
        json_str = {"time": te - ts, "API": func_str}
        time_distribution.append(json_str)
    xbridge_utils.export_data("defined_seq_market_actions_api_calls.xlsx",
                              time_distribution)
def test_cancel_load_v3(nb_of_runs):
    time_distribution = []
    total_elapsed_seconds = 0
    for i in range(1, nb_of_runs):
        garbage_input_str = xbridge_utils.generate_garbage_input(64)
        ts = time.time()
        assert type(xbridge_client.CHECK_CANCEL_TX(garbage_input_str)) == dict
        te = time.time()
        total_elapsed_seconds += te - ts
        json_str = {
            "time": te - ts,
            "char_nb": len(garbage_input_str),
            "API": "dxCancel"
        }
        time_distribution.append(json_str)
    xbridge_utils.export_data("test_cancel_load_v3.xlsx", time_distribution)
 def test_invalid_cancel_4(self):
     # We pick from a single class at a time
     self.assertIsInstance(
         xbridge_client.CHECK_CANCEL_TX(
             StringGenerator('[\a]{1:11000}').render()), dict)
     self.assertIsInstance(
         xbridge_client.CHECK_CANCEL_TX(
             StringGenerator('[\p]{1:11000}').render()), dict)
     self.assertIsInstance(
         xbridge_client.CHECK_CANCEL_TX(
             StringGenerator('[\d]{1:11000}').render()), dict)
     self.assertIsInstance(
         xbridge_client.CHECK_CANCEL_TX(
             StringGenerator('[\W]{1:11000}').render()), dict)
     self.assertIsInstance(
         xbridge_client.CHECK_CANCEL_TX(
             StringGenerator('[\w]{1:11000}').render()), dict)
     self.assertIsInstance(
         xbridge_client.CHECK_CANCEL_TX(
             StringGenerator('[\h]{1:11000}').render()), dict)
     self.assertIsInstance(
         xbridge_client.CHECK_CANCEL_TX(
             StringGenerator('[\s]{1:11000}').render()), dict)
     # We pick from combinations of 2 classes
     self.assertIsInstance(
         xbridge_client.CHECK_CANCEL_TX(
             StringGenerator('[\p\d]{1:11000}').render()), dict)
     self.assertIsInstance(
         xbridge_client.CHECK_CANCEL_TX(
             StringGenerator('[\p\a]{1:11000}').render()), dict)
     self.assertIsInstance(
         xbridge_client.CHECK_CANCEL_TX(
             StringGenerator('[\p\h]{1:11000}').render()), dict)
     self.assertIsInstance(
         xbridge_client.CHECK_CANCEL_TX(
             StringGenerator('[\s\d]{1:11000}').render()), dict)
     self.assertIsInstance(
         xbridge_client.CHECK_CANCEL_TX(
             StringGenerator('[\s\a]{1:11000}').render()), dict)
     self.assertIsInstance(
         xbridge_client.CHECK_CANCEL_TX(
             StringGenerator('[\s\h]{1:11000}').render()), dict)
     self.assertIsInstance(
         xbridge_client.CHECK_CANCEL_TX(
             StringGenerator('[\s\p]{1:11000}').render()), dict)
     self.assertIsInstance(
         xbridge_client.CHECK_CANCEL_TX(
             StringGenerator('[\W\d]{1:11000}').render()), dict)
     self.assertIsInstance(
         xbridge_client.CHECK_CANCEL_TX(
             StringGenerator('[\W\a]{1:11000}').render()), dict)
     self.assertIsInstance(
         xbridge_client.CHECK_CANCEL_TX(
             StringGenerator('[\W\h]{1:11000}').render()), dict)
     self.assertIsInstance(
         xbridge_client.CHECK_CANCEL_TX(
             StringGenerator('[\W\p]{1:11000}').render()), dict)
     # We pick from combinations of 3 classes
     self.assertIsInstance(
         xbridge_client.CHECK_CANCEL_TX(
             StringGenerator('[\a\d\W]{1:11000}').render()), dict)
     self.assertIsInstance(
         xbridge_client.CHECK_CANCEL_TX(
             StringGenerator('[\a\d\h]{1:11000}').render()), dict)
     self.assertIsInstance(
         xbridge_client.CHECK_CANCEL_TX(
             StringGenerator('[\a\d\s]{1:11000}').render()), dict)
     self.assertIsInstance(
         xbridge_client.CHECK_CANCEL_TX(
             StringGenerator('[\a\d\p]{1:11000}').render()), dict)
     self.assertIsInstance(
         xbridge_client.CHECK_CANCEL_TX(
             StringGenerator('[\a\d\W]{1:11000}').render()), dict)
     # We pick from combinations of 4 classes
     self.assertIsInstance(
         xbridge_client.CHECK_CANCEL_TX(
             StringGenerator('[\p\d\w\s]{1:11000}').render()), dict)
     self.assertIsInstance(
         xbridge_client.CHECK_CANCEL_TX(
             StringGenerator('[\p\d\a\h]{1:11000}').render()), dict)
     self.assertIsInstance(
         xbridge_client.CHECK_CANCEL_TX(
             StringGenerator('[\p\d\a\s]{1:11000}').render()), dict)
     # We pick from combinations of 5 classes
     self.assertIsInstance(
         xbridge_client.CHECK_CANCEL_TX(
             StringGenerator('[\p\d\W\w\h\a]{1:11000}').render()), dict)