コード例 #1
0
    def _create_wagers(player, wagers=[]):
        _wagers = [create_casino()] if wagers == [] else wagers
        logging.info("Creating wagers: {}".format([r.__dict__ for r in _wagers]))

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

        logging.info("API response: {}".format(response.json()))
        return wagers, response.json()["RequestID"]
コード例 #2
0
 def test_tc_13_wager_casino_future_transaction_date(self):
     wager = create_casino()
     wager.TransactionDate = datetime.datetime(2030, 4, 24, 18, 26, 1, 37000).strftime('%Y-%m-%d')
     player, revenue, request_id = self._create_player_with_wager([wager])
     self.assert_not_created(request_id, player)
コード例 #3
0
 def test_tc_12_wager_casino_invalid_transaction_date(self):
     wager = create_casino()
     wager.TransactionDate = "invalid_date"
     player, revenue, request_id = self._create_player_with_wager([wager])
     self.assert_not_created(request_id, player)
コード例 #4
0
 def test_tc_11_player_wager_casino_huge_count(self):
     wager = create_casino()
     wager.Count = 10000000000000
     player, revenue, request_id = self._create_player_with_wager([wager])
     result = self.get_wager_from_db(player)
     self.assertFalse(result == [])
コード例 #5
0
 def test_tc_10_player_wager_casino_negative_count(self):
     wager = create_casino()
     wager.Count = -1
     player, revenue, request_id = self._create_player_with_wager([wager])
     self.assert_not_created(request_id, player)
コード例 #6
0
 def test_tc_8_player_wager_casino_invalid_count(self):
     wager = create_casino()
     wager.Count = "invalid"
     player, revenue, request_id = self._create_player_with_wager([wager])
     result = self.get_wager_from_db(player)
コード例 #7
0
 def test_tc_7_player_wager_casino_usd_currency(self):
     wager = create_casino()
     wager.Currency = "USD"
     player, revenue, request_id = self._create_player_with_wager([wager])
     result = self.get_wager_from_db(player)
     self.assertFalse(result == [])
コード例 #8
0
 def test_tc_6_player_wager_casino_invalid_currency(self):
     wager = create_casino()
     wager.Currency = "Invalid"
     player, revenue, request_id = self._create_player_with_wager([wager])
     self.assert_not_created(request_id, player)
コード例 #9
0
 def test_tc_5_player_wager_casino_huge_value(self):
     wager = create_casino()
     wager.Value = 10000000000000
     player, revenue, request_id = self._create_player_with_wager([wager])
     self.assert_not_created(request_id, player)
コード例 #10
0
 def test_tc_3_player_wager_casino_negative_value(self):
     wager = create_casino()
     wager.Value = -1
     player, revenue, request_id = self._create_player_with_wager([wager])
     self.assert_not_created(request_id, player)
コード例 #11
0
 def test_tc_2_player_wager_casino_invalid_value(self):
     wager = create_casino()
     wager.Value = "value"
     player, wager, request_id = self._create_player_with_wager([wager])
     self.assert_not_created(request_id, player)
コード例 #12
0
 def test_tc_14_wager_casino_without_game_type(self):
     wager = create_casino()
     wager.GameType = None
     player, revenue, request_id = self._create_player_with_wager([wager])
     result = self.get_wager_from_db(player)
     self.assertTrue(result == [])