示例#1
0
    def test_tc_9_player_revenue_with_multiple_transactions(self):
        revenue_1 = create_revenue()
        revenue_2 = create_revenue()
        player, revenues, _ = self._create_player_with_revenue(
            revenues=[revenue_1, revenue_2])
        result = self.get_revenue_from_db(player)
        logging.info("DB result: {}".format(result))

        self.assertFalse(result == [])
        self.assertEquals(len(result), 2)
示例#2
0
 def create_deposit(self):
     transactions = [create_revenue() for i in range(100)]
     data = {"PlayerID": self.player.PlayerID, "InitID": generate_random_int(),
             "Transactions": [r.__dict__ for r in transactions]}
     self.client.post(get_deposit_resource(),
                      data=json.dumps(data),
                      headers=get_api_headers())
示例#3
0
 def test_tc_8_player_revenue_with_invalid_date(self):
     revenue = create_revenue()
     revenue.TransactionDate = "hah"
     player, revenue, request_id = self._create_player_with_revenue(
         [revenue])
     task = self.get_task(request_id)[0]
     logging.info("Task: {}".format(task))
     self.assertFalse(task["Error"] == "")
示例#4
0
 def test_tc_6_player_revenue_with_string_amount(self):
     revenue = create_revenue()
     revenue.Amount = "sdk"
     player, revenue, request_id = self._create_player_with_revenue(
         [revenue])
     task = self.get_task(request_id)[0]
     logging.info("Task: {}".format(task))
     self.assertFalse(task["Error"] == "")
示例#5
0
 def test_tc_3_player_revenue_with_invalid_currency(self):
     revenue = create_revenue()
     revenue.Currency = 123
     player, revenue, request_id = self._create_player_with_revenue(
         [revenue])
     task = self.get_task(request_id)[0]
     logging.info("Task: {}".format(task))
     self.assertFalse(task["Error"] == "")
示例#6
0
 def test_tc_7_player_revenue_with_future_date(self):
     revenue = create_revenue()
     revenue.TransactionDate = datetime.datetime(2030, 4, 24, 18, 26, 1,
                                                 37000).strftime('%Y-%m-%d')
     player, revenue, request_id = self._create_player_with_revenue(
         [revenue])
     task = self.get_task(request_id)[0]
     logging.info("Task: {}".format(task))
     self.assertFalse(task["Error"] == "")
示例#7
0
    def test_tc_2_player_revenue_with_eur_currency(self):
        revenue = create_revenue()
        revenue.Currency = "EUR"
        player, revenue, _ = self._create_player_with_revenue([revenue])
        result = self.get_revenue_from_db(player)
        logging.info("DB result: {}".format(result))

        self.assertFalse(result == [])
        self.assertEquals(
            int(revenue[0].Amount) * 100, result[0]["EuroAmount"])
示例#8
0
    def _create_revenues(player, revenues=[]):
        revenues = [create_revenue()] if revenues == [] else revenues
        logging.info("Creating revenue: {}".format(
            [r.__dict__ for r in revenues]))

        data = {
            "PlayerID": player.PlayerID,
            "InitID": generate_random_int(),
            "Transactions": [r.__dict__ for r in revenues]
        }
        logging.info("Request data: {}".format(json.dumps(data)))
        response = requests.post(get_deposit_resource(),
                                 data=json.dumps(data),
                                 headers=get_api_headers())

        logging.info("API response: {}".format(response.json()))
        return revenues, response.json()["RequestID"]