Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_get_price(self):
client = SteamClient(self.credentials.api_key)
item = 'M4A1-S | Cyrex (Factory New)'
prices = client.market.fetch_price(item, GameOptions.CS)
self.assertTrue(prices['success'])
def test_make_offer(self):
client = SteamClient(self.credentials.api_key)
client.login(self.credentials.login, self.credentials.password, self.steam_guard_file)
partner_id = ''
game = GameOptions.CS
my_items = client.get_my_inventory(game)
partner_items = client.get_partner_inventory(partner_id, game)
my_first_item = next(iter(my_items.values()))
partner_first_item = next(iter(partner_items.values()))
my_asset = Asset(my_first_item['id'], game)
partner_asset = Asset(partner_first_item['id'], game)
response = client.make_offer([my_asset], [partner_asset], partner_id, 'TESTOWA OFERTA')
self.assertIsNotNone(response)
self.assertIn('tradeofferid', response.keys())
def test_get_my_inventory(self):
client = SteamClient(self.credentials.api_key)
client.login(self.credentials.login, self.credentials.password, self.steam_guard_file)
inventory = client.get_my_inventory(GameOptions.CS)
self.assertIsNotNone(inventory)
def test_create_and_cancel_buy_order(self):
client = SteamClient(self.credentials.api_key)
client.login(self.credentials.login, self.credentials.password, self.steam_guard_file)
# PUT THE REAL CURRENCY OF YOUR STEAM WALLET, OTHER CURRENCIES WILL NOT WORK
response = client.market.create_buy_order("AK-47 | Redline (Field-Tested)", "10.34", 2, GameOptions.CS,
Currency.EURO)
buy_order_id = response["buy_orderid"]
self.assertTrue(response["success"] == 1)
self.assertIsNotNone(buy_order_id)
response = client.market.cancel_buy_order(buy_order_id)
self.assertTrue(response["success"])