def test_invalid_create_tx_v8(self):
     # very small + very small
     self.assertIsNone(
         xbridge_client.CHECK_CREATE_TX(self.valid_src_Address,
                                        self.valid_src_Token,
                                        self.invalid_sm_positive_nb,
                                        self.valid_dest_Address,
                                        self.valid_dest_Token,
                                        self.invalid_sm_positive_nb))
     # very small + very large
     self.assertIsNone(
         xbridge_client.CHECK_CREATE_TX(self.valid_src_Address,
                                        self.valid_src_Token,
                                        self.invalid_sm_positive_nb,
                                        self.valid_dest_Address,
                                        self.valid_dest_Token,
                                        self.invalid_lg_positive_nb))
     # very large + very small
     self.assertIsNone(
         xbridge_client.CHECK_CREATE_TX(self.valid_src_Address,
                                        self.valid_src_Token,
                                        self.invalid_lg_positive_nb,
                                        self.valid_dest_Address,
                                        self.valid_dest_Token,
                                        self.invalid_sm_positive_nb))
     # very large + very large
     self.assertIsNone(
         xbridge_client.CHECK_CREATE_TX(self.valid_src_Address,
                                        self.valid_src_Token,
                                        self.invalid_lg_positive_nb,
                                        self.valid_dest_Address,
                                        self.valid_dest_Token,
                                        self.invalid_lg_positive_nb))
 def test_invalid_create_tx_v3(self):
     # Same source and destination Addresses, all other parameters being valid
     self.assertIsNone(
         xbridge_client.CHECK_CREATE_TX(self.valid_src_Address,
                                        self.valid_src_Token,
                                        self.valid_positive_nb_1,
                                        self.valid_src_Address,
                                        self.valid_dest_Token,
                                        self.valid_positive_nb_2))
     # Same source and destination Tokens, different addresses, all other parameters being valid
     self.assertIsNone(
         xbridge_client.CHECK_CREATE_TX(self.valid_src_Address,
                                        self.valid_src_Token,
                                        self.valid_positive_nb_1,
                                        self.valid_dest_Address,
                                        self.valid_src_Token,
                                        self.valid_positive_nb_2))
     # Same source and destination Addresses and Tokens, all other parameters being valid
     self.assertIsNone(
         xbridge_client.CHECK_CREATE_TX(self.valid_src_Address,
                                        self.valid_src_Token,
                                        self.valid_positive_nb_1,
                                        self.valid_src_Address,
                                        self.valid_src_Token,
                                        self.valid_positive_nb_2))
 def test_invalid_create_tx_v2(self):
     self.assertIsNone(
         xbridge_client.CHECK_CREATE_TX(" ", self.valid_src_Token,
                                        self.valid_positive_nb_1,
                                        self.valid_dest_Address, "SYS",
                                        self.valid_positive_nb_2))
     self.assertIsNone(
         xbridge_client.CHECK_CREATE_TX(
             "LTnoVFAnKSMj4v2eFXBJuMmyjqSQT9eXBy", self.valid_src_Token,
             self.valid_positive_nb_1, " ", "SYS",
             self.valid_positive_nb_2))
     self.assertIsNone(
         xbridge_client.CHECK_CREATE_TX(" ", self.valid_src_Token,
                                        self.valid_positive_nb_1, " ",
                                        "SYS", self.valid_positive_nb_2))
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_createtx_garbage_load_v2(nb_of_runs):
    time_distribution = []
    total_elapsed_seconds = 0
    for i in range(1, nb_of_runs):
        garbage_input_str1 = xbridge_utils.generate_garbage_input(
            xbridge_utils.generate_random_number(1, 10000))
        garbage_input_str2 = xbridge_utils.generate_garbage_input(
            xbridge_utils.generate_random_number(1, 10000))
        garbage_input_str3 = xbridge_utils.generate_garbage_input(
            xbridge_utils.generate_random_number(1, 10000))
        garbage_input_str4 = xbridge_utils.generate_garbage_input(
            xbridge_utils.generate_random_number(1, 10000))
        source_nb = xbridge_utils.generate_random_number(
            -99999999999999999999999999999999999999999999999,
            99999999999999999999999999999999999999999999999)
        dest_nb = xbridge_utils.generate_random_number(
            -99999999999999999999999999999999999999999999999,
            99999999999999999999999999999999999999999999999)
        ts = time.time()
        xbridge_client.CHECK_CREATE_TX(garbage_input_str1, garbage_input_str2,
                                       source_nb, garbage_input_str3,
                                       garbage_input_str4, dest_nb)
        te = time.time()
        total_elapsed_seconds += te - ts
        json_str = {"time": te - ts, "API": "dxCreateTransaction"}
        time_distribution.append(json_str)
    xbridge_utils.export_data("test_createtx_garbage_load_v2.xlsx",
                              time_distribution)
 def test_invalid_create_tx_v5(self):
     self.assertIsNone(
         xbridge_client.CHECK_CREATE_TX(
             "'LTnoVFAnKSMj4v2eFXBJuMmyjqSQT9eXBy'", "LTC",
             self.invalid_neg_nb, "'LTnoVFAnKSMj4v2eFXBJuMmyjqSQT9eXBy'",
             "LTC", self.invalid_neg_nb))
     self.assertIsNone(
         xbridge_client.CHECK_CREATE_TX(
             "LTnoVFAnKSMj4v2eFXBJuMmyjqSQT9eXBy", self.valid_src_Token,
             self.valid_positive_nb_1, "LTnoVFAnKSMj4v2eFXBJuMmyjqSQT9eXBy",
             "LTC", self.invalid_neg_nb))
     self.assertIsNone(
         xbridge_client.CHECK_CREATE_TX(
             "LTnoVFAnKSMj4v2eFXBJuMmyjqSQT9eXBy", self.valid_src_Token,
             self.invalid_neg_nb, "LTnoVFAnKSMj4v2eFXBJuMmyjqSQT9eXBy",
             "LTC", self.valid_positive_nb_1))
 def test_invalid_create_tx_v4(self):
     # Address 1 contains quotes, all other parameters being valid
     self.assertIsNone(
         xbridge_client.CHECK_CREATE_TX(
             "'LTnoVFAnKSMj4v2eFXBJuMmyjqSQT9eXBy'", self.valid_src_Token,
             self.valid_positive_nb_1, "12BueeBVD2uiAHViXf7jPVQb2MSQ1Eggey",
             self.valid_dest_Token, self.valid_positive_nb_2))
     # Address 2 contains quotes, all other parameters being valid
     self.assertIsNone(
         xbridge_client.CHECK_CREATE_TX(
             "LTnoVFAnKSMj4v2eFXBJuMmyjqSQT9eXBy", self.valid_src_Token,
             self.valid_positive_nb_1,
             "'12BueeBVD2uiAHViXf7jPVQb2MSQ1Eggey'", self.valid_dest_Token,
             self.valid_positive_nb_2))
     # Both Addresses contain quotes, all other parameters being valid
     self.assertIsNone(
         xbridge_client.CHECK_CREATE_TX(
             "'LTnoVFAnKSMj4v2eFXBJuMmyjqSQT9eXBy'", self.valid_src_Token,
             self.valid_positive_nb_1,
             "'12BueeBVD2uiAHViXf7jPVQb2MSQ1Eggey'", self.valid_dest_Token,
             self.valid_positive_nb_2))
 def test_invalid_create_tx_v7(self):
     self.assertIsNone(
         xbridge_client.CHECK_CREATE_TX(self.valid_src_Address,
                                        self.valid_src_Token,
                                        self.nb_with_leading_zeros_1,
                                        self.valid_dest_Address,
                                        self.valid_dest_Token,
                                        self.valid_positive_nb_2))
     self.assertIsNone(
         xbridge_client.CHECK_CREATE_TX(self.valid_src_Address,
                                        self.valid_src_Token,
                                        self.valid_positive_nb_1,
                                        self.valid_dest_Address,
                                        self.valid_dest_Token,
                                        self.nb_with_leading_zeros_1))
     self.assertIsNone(
         xbridge_client.CHECK_CREATE_TX(self.valid_src_Address,
                                        self.valid_src_Token,
                                        self.nb_with_leading_zeros_1,
                                        self.valid_dest_Address,
                                        self.valid_dest_Token,
                                        self.nb_with_leading_zeros_2))
 def test_invalid_create_tx_v6(self):
     # Only source Address is valid, the rest is invalid
     self.assertIsNone(
         xbridge_client.CHECK_CREATE_TX(self.valid_src_Address,
                                        self.invalid_src_Token,
                                        self.invalid_neg_nb,
                                        self.invalid_dest_Address,
                                        self.invalid_dest_Token,
                                        self.invalid_neg_nb))
     # Only source Address + source Token are valid, the rest is invalid
     self.assertIsNone(
         xbridge_client.CHECK_CREATE_TX(self.valid_src_Address,
                                        self.valid_src_Token,
                                        self.invalid_neg_nb,
                                        self.invalid_dest_Address,
                                        self.invalid_dest_Token,
                                        self.invalid_neg_nb))
     # Only source Address + source Token + source_Quantity are valid, the rest is invalid
     self.assertIsNone(
         xbridge_client.CHECK_CREATE_TX(self.valid_src_Address,
                                        self.valid_src_Token,
                                        self.valid_positive_nb_1,
                                        self.invalid_dest_Address,
                                        self.invalid_dest_Token,
                                        self.invalid_neg_nb))
     # Only (source + dest) Addresses + source Token + source_Quantity are valid, the rest is invalid
     self.assertIsNone(
         xbridge_client.CHECK_CREATE_TX(self.valid_src_Address,
                                        self.valid_src_Token,
                                        self.valid_positive_nb_1,
                                        self.valid_dest_Address,
                                        self.invalid_dest_Token,
                                        self.invalid_neg_nb))
     # Only (source + dest) Addresses + (source + dest)  Tokens + source_Quantity are valid, the rest is invalid
     self.assertIsNone(
         xbridge_client.CHECK_CREATE_TX(self.valid_src_Address,
                                        self.valid_src_Token,
                                        self.valid_positive_nb_1,
                                        self.valid_dest_Address,
                                        self.valid_dest_Token,
                                        self.invalid_neg_nb))
     # All parameters are invalid
     self.assertIsNone(
         xbridge_client.CHECK_CREATE_TX(self.invalid_src_Address,
                                        self.invalid_src_Token,
                                        self.invalid_neg_nb,
                                        self.invalid_dest_Address,
                                        self.invalid_dest_Token,
                                        self.invalid_neg_nb))
 def test_invalid_create_tx_v1(self):
     # negative_number + positive_number, all other parameters being valid
     self.assertIsNone(
         xbridge_client.CHECK_CREATE_TX(self.valid_src_Address,
                                        self.valid_src_Token,
                                        self.invalid_neg_nb,
                                        self.valid_dest_Address,
                                        self.valid_dest_Token,
                                        self.valid_positive_nb_2))
     # positive_number + negative_number, all other parameters being valid
     self.assertIsNone(
         xbridge_client.CHECK_CREATE_TX(self.valid_src_Address,
                                        self.valid_src_Token,
                                        self.valid_positive_nb_1,
                                        self.valid_dest_Address,
                                        self.valid_dest_Token,
                                        self.invalid_neg_nb))
     # negative_number + negative_number, all other parameters being valid
     self.assertIsNone(
         xbridge_client.CHECK_CREATE_TX(self.valid_src_Address,
                                        self.valid_src_Token,
                                        self.invalid_neg_nb,
                                        self.valid_dest_Address,
                                        self.valid_dest_Token,
                                        self.invalid_neg_nb))
     # 0 + negative_number, all other parameters being valid
     self.assertIsNone(
         xbridge_client.CHECK_CREATE_TX(self.valid_src_Address,
                                        self.valid_src_Token, 0,
                                        self.valid_dest_Address,
                                        self.valid_dest_Token,
                                        self.invalid_neg_nb))
     # positive_number + 0, all other parameters being valid
     self.assertIsNone(
         xbridge_client.CHECK_CREATE_TX(self.valid_src_Address,
                                        self.valid_src_Token,
                                        self.valid_positive_nb_1,
                                        self.valid_dest_Address,
                                        self.valid_dest_Token, 0))
     # 0 + 0, all other parameters being valid
     self.assertIsNone(
         xbridge_client.CHECK_CREATE_TX(self.valid_src_Address,
                                        self.valid_src_Token, 0,
                                        self.valid_dest_Address,
                                        self.valid_dest_Token, 0))