def test_tc_8_player_withdrawal_with_invalid_date(self): withdrawal = create_withdrawal() withdrawal.TransactionDate = "hah" player, withdrawal, request_id = self._create_player_with_withdrawal( withdrawal) task = self.get_task(request_id)[0] logging.info("Task: {}".format(task)) self.assertFalse(task["Error"] == "")
def test_tc_6_player_withdrawal_with_string_amount(self): withdrawal = create_withdrawal() withdrawal.amount = "sdk" player, withdrawal, request_id = self._create_player_with_withdrawal( withdrawal) task = self.get_task(request_id)[0] logging.info("Task: {}".format(task)) self.assertFalse(task["Error"] == "")
def test_tc_3_player_withdrawal_with_invalid_currency(self): withdrawal = create_withdrawal() withdrawal.currency = 123 player, withdrawal, request_id = self._create_player_with_withdrawal( withdrawal) task = self.get_task(request_id)[0] logging.info("Task: {}".format(task)) self.assertFalse(task["Error"] == "")
def create_withdrawal(self): withdrawals = [create_withdrawal()] data = { "PlayerID": self.player.PlayerID, "InitID": generate_random_int(), "Withdrawals": [r.__dict__ for r in withdrawals] } self.client.post(get_withdrawal_resource(), data=json.dumps(data), headers=get_api_headers())
def test_tc_2_player_withdrawal_with_eur_currency(self): _withdrawal = create_withdrawal() _withdrawal.currency = "EUR" player, withdrawal, _ = self._create_player_with_withdrawal( _withdrawal) result = self.get_withdrawal_from_db(player) logging.info("DB result: {}".format(result)) self.assertFalse(result == []) self.assertEquals(int(_withdrawal.amount) * 100, result[0]["Amount"])
def test_tc_7_player_withdrawal_with_future_date(self): withdrawal = create_withdrawal() withdrawal.transaction_date = datetime.datetime( 2030, 4, 24, 18, 26, 1, 37000).strftime('%Y-%m-%d') player, withdrawal, request_id = self._create_player_with_withdrawal( withdrawal) result = self.get_withdrawal_from_db(player) logging.info("DB result: {}".format(result)) self.assertFalse(result == []) self.assertTrue(result[0]["Amount"] != 0)
def _create_player_with_withdrawal(withdrawal=None): player = create_random_player(player_id_length=40) logging.info("Creating player: {}".format(player.__dict__)) response = requests.post(get_player_sign_up_resource(), data=json.dumps(player.__dict__), headers=get_api_headers()) body = response.json() logging.info("API response: {}".format(body)) withdrawal = create_withdrawal() if withdrawal is None else withdrawal logging.info("Creating withdrawal: {}".format(withdrawal.__dict__)) data = { "PlayerID": player.PlayerID, "InitID": generate_random_int(), "Withdrawals": [withdrawal.__dict__] } logging.info("Request data: {}".format(data)) response = requests.post(get_withdrawal_resource(), data=json.dumps(data), headers=get_api_headers()) logging.info("API response: {}".format(response.json())) return player, withdrawal, response.json()["RequestID"]