本文整理汇总了Python中shiba.salesmanagement.SalesManagement.get_item_infos方法的典型用法代码示例。如果您正苦于以下问题:Python SalesManagement.get_item_infos方法的具体用法?Python SalesManagement.get_item_infos怎么用?Python SalesManagement.get_item_infos使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类shiba.salesmanagement.SalesManagement
的用法示例。
在下文中一共展示了SalesManagement.get_item_infos方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_item_infos
# 需要导入模块: from shiba.salesmanagement import SalesManagement [as 别名]
# 或者: from shiba.salesmanagement.SalesManagement import get_item_infos [as 别名]
def test_get_item_infos(connection):
"""get_item_infos on a unknown product, must fail"""
sales_management = SalesManagement(connection)
obj = None
try:
obj = sales_management.get_item_infos("181063")
except ShibaServiceError:
pass
assert obj is None
示例2: test_get_item_infos
# 需要导入模块: from shiba.salesmanagement import SalesManagement [as 别名]
# 或者: from shiba.salesmanagement.SalesManagement import get_item_infos [as 别名]
def test_get_item_infos(monkeypatch):
"""get_item_infos on a product"""
monkeypatch.setattr("requests.get", make_requests_get_mock("sample_getiteminfos.xml"))
sales_management = SalesManagement(ShibaConnection("test", "test", "https://ws.sandbox.priceminister.com"))
obj = sales_management.get_item_infos("181063")
assert obj.content.tag == "getiteminfosresult"
示例3: SalesManagementTest
# 需要导入模块: from shiba.salesmanagement import SalesManagement [as 别名]
# 或者: from shiba.salesmanagement.SalesManagement import get_item_infos [as 别名]
class SalesManagementTest(unittest.TestCase):
"""SalesManagement class unit tests, as it's not possible to emulate a real seller profile, most of those tests
are only verifying the proper handling of errors"""
def setUp(self):
settings = ConfigParser.ConfigParser()
try:
settings.read(os.path.dirname(os.path.realpath(__file__)) + "/Assets/nosetests.cfg")
except:
raise ShibaCallingError("error : can't read login ID from the nosetests.cfg file")
try:
login = settings.get(str("NoseConfig"), "login")
pwd = settings.get(str("NoseConfig"), "pwd")
except:
raise ShibaCallingError("error : configuration file doesn't seem to be regular")
self.init = SalesManagement(ShibaConnection(login, pwd, "https://ws.sandbox.priceminister.com"))
def test_get_new_sales(self):
"""regular get_new_sales test"""
obj = self.init.get_new_sales()
self.assertTrue("getnewsalesresult" in obj.content.tag)
def test_accept_sale(self):
"""Only fail result, as accepting an actual sale is not simulable"""
itemid = "000000"
obj = None
try:
obj = self.init.accept_sale(itemid)
except ShibaServiceError:
pass
except ShibaParameterError:
pass
def test_refuse_sale(self):
"""Only fail result, as refusing an actual sale is not simulable"""
itemid = "000000"
obj = None
try:
obj = self.init.refuse_sale(itemid)
except ShibaServiceError:
pass
except ShibaParameterError:
pass
def test_get_current_sales(self):
"""get_current_sales test, on variable parameters, plus some fail results"""
obj = self.init.get_current_sales()
self.assertIn("getcurrentsalesresult", obj.content.tag)
self.assertFalse(obj.content.request.ispendingpreorder)
obj = self.init.get_current_sales(ispendingpreorder="y")
self.assertIn("getcurrentsalesresult", obj.content.tag)
self.assertTrue(obj.content.request.ispendingpreorder)
try:
self.init.get_current_sales(ispendingpreorder="n")
except ShibaCallingError:
pass
obj = self.init.get_current_sales(purchasedate="WRONGDATE")
self.assertTrue(elem.content.tag is not "purchasedate" for elem in obj.content.response)
obj = self.init.get_current_sales(purchasedate="2012-12-21")
self.assertEqual("21/12/2012", obj.content.request.purchasedate)
def test_get_billing_information(self):
"""get_billing_information test, will raise an error due to unknown purchaseid"""
obj = None
try:
obj = self.init.get_billing_information("1337")
except ShibaServiceError:
pass
self.assertIsNone(obj)
def test_get_shipping_information(self):
"""get_billing_information test, will raise an error due to unknown purchaseid"""
obj = None
try:
obj = self.init.get_shipping_information("1337")
except ShibaServiceError:
pass
self.assertIsNone(obj)
def test_get_items_todo_list(self):
"""get_items_todo_list routine test"""
obj = self.init.get_item_todo_list()
self.assertIn("getitemtodolistresult", obj.content.tag)
def test_get_item_infos(self):
"""get_item_infos on a unknown product, must fail"""
obj = None
try:
obj = self.init.get_item_infos("181063")
except ShibaServiceError:
pass
self.assertIsNone(obj)
def test_cancel_item(self):
"""cancel_item on an unknown product, must fail"""
obj = None
try:
obj = self.init.cancel_item("1337", "comment")
except ShibaServiceError:
pass
self.assertIsNone(obj)
#.........这里部分代码省略.........