コード例 #1
0
ファイル: test_withdrawal.py プロジェクト: sbaldassin/pepito
 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"] == "")
コード例 #2
0
ファイル: test_withdrawal.py プロジェクト: sbaldassin/pepito
 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"] == "")
コード例 #3
0
ファイル: test_withdrawal.py プロジェクト: sbaldassin/pepito
 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"] == "")
コード例 #4
0
 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())
コード例 #5
0
ファイル: test_withdrawal.py プロジェクト: sbaldassin/pepito
    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"])
コード例 #6
0
ファイル: test_withdrawal.py プロジェクト: sbaldassin/pepito
    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)
コード例 #7
0
ファイル: test_withdrawal.py プロジェクト: sbaldassin/pepito
    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"]