def test_parse_contract_items(self): api_result = make_api_result("char/contract_items.xml") result = evelink_c.parse_contract_items(api_result) self.assertEqual(result, [ {'id': 779703190, 'quantity': 490, 'type_id': 17867, 'action': 'offered', 'singleton': False}, {'id': 779703191, 'quantity': 60, 'type_id': 17868, 'action': 'offered', 'singleton': False}, {'id': 779703192, 'quantity': 8360, 'type_id': 1228, 'action': 'offered', 'singleton': False}, {'id': 779703193, 'quantity': 16617, 'type_id': 1228, 'action': 'offered', 'singleton': False}, ])
def test_parse_contract_items(self): api_result, _, _ = make_api_result("char/contract_items.xml") result = evelink_c.parse_contract_items(api_result) self.assertEqual( result, [ {"id": 779703190, "quantity": 490, "type_id": 17867, "action": "offered", "singleton": False}, {"id": 779703191, "quantity": 60, "type_id": 17868, "action": "offered", "singleton": False}, {"id": 779703192, "quantity": 8360, "type_id": 1228, "action": "offered", "singleton": False}, {"id": 779703193, "quantity": 16617, "type_id": 1228, "action": "offered", "singleton": False}, { "id": 779703194, "quantity": 1, "type_id": 973, "action": "offered", "singleton": True, "raw_quantity": -2, }, ], )
def test_parse_contract_items(self): api_result, _, _ = make_api_result("char/contract_items.xml") result = evelink_c.parse_contract_items(api_result) self.assertEqual(result, [ { 'id': 779703190, 'quantity': 490, 'type_id': 17867, 'action': 'offered', 'singleton': False }, { 'id': 779703191, 'quantity': 60, 'type_id': 17868, 'action': 'offered', 'singleton': False }, { 'id': 779703192, 'quantity': 8360, 'type_id': 1228, 'action': 'offered', 'singleton': False }, { 'id': 779703193, 'quantity': 16617, 'type_id': 1228, 'action': 'offered', 'singleton': False }, { 'id': 779703194, 'quantity': 1, 'type_id': 973, 'action': 'offered', 'singleton': True, 'raw_quantity': -2 }, ])
def contract_items(self, contract_id, api_result=None): """Lists items that a specified contract contains""" return api.APIResult(parse_contract_items(api_result.result), api_result.timestamp, api_result.expires)
def contract_items(self, contract_id): """Lists items that a specified contract contains""" api_result = self.api.get('corp/ContractItems', {'contractID': contract_id}) return parse_contract_items(api_result)
def contract_items(self, contract_id, api_result=None): """Lists items that a specified contract contains""" if api_result is None: api_result = self.api.get('corp/ContractItems', {'contractID': contract_id}) return api.APIResult(parse_contract_items(api_result.result), api_result.timestamp, api_result.expires)