本文整理汇总了Python中shiba.salesmanagement.SalesManagement类的典型用法代码示例。如果您正苦于以下问题:Python SalesManagement类的具体用法?Python SalesManagement怎么用?Python SalesManagement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SalesManagement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_new_sales
def test_get_new_sales(monkeypatch):
"""regular get_new_sales test"""
monkeypatch.setattr("requests.get", make_requests_get_mock("sample_getnewsales.xml"))
sales_management = SalesManagement(ShibaConnection("test", "test", "https://ws.sandbox.priceminister.com"))
obj = sales_management.get_new_sales()
assert "getnewsalesresult" in obj.content.tag
示例2: test_get_shipping_information
def test_get_shipping_information(monkeypatch):
"""get_billing_information test"""
monkeypatch.setattr("requests.get", make_requests_get_mock("sample_getshippinginformation.xml"))
sales_management = SalesManagement(ShibaConnection("test", "test", "https://ws.sandbox.priceminister.com"))
obj = None
obj = sales_management.get_shipping_information("1337")
assert obj is not None
assert obj.content.tag == "getshippinginformationresult"
示例3: test_cancel_item
def test_cancel_item(connection):
"""cancel_item on an unknown product, must fail"""
sales_management = SalesManagement(connection)
obj = None
try:
obj = sales_management.cancel_item("1337", "comment")
except ShibaServiceError:
pass
assert obj is None
示例4: test_contact_user_about_item
def test_contact_user_about_item(connection):
"""contact_user_about_item on an unknown product, must fail"""
sales_management = SalesManagement(connection)
obj = None
try:
obj = sales_management.contact_user_about_item("1337", "message")
except ShibaServiceError:
pass
assert obj is None
示例5: test_get_item_infos
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
示例6: test_get_shipping_information
def test_get_shipping_information(connection):
"""get_billing_information test, will raise an error due to unknown purchaseid"""
sales_management = SalesManagement(connection)
obj = None
try:
obj = sales_management.get_shipping_information("1337")
except ShibaServiceError:
pass
assert obj is None
示例7: test_refuse_sale
def test_refuse_sale(connection):
"""Only fail result, as refusing an actual sale is not simulable"""
sales_management = SalesManagement(connection)
itemid = "000000"
obj = None
try:
obj = sales_management.refuse_sale(itemid)
except ShibaServiceError:
pass
except ShibaParameterError:
pass
示例8: test_set_tracking_package_infos
def test_set_tracking_package_infos(monkeypatch):
"""set_tracking_package_infos on a product. Testing internal error catching as well."""
monkeypatch.setattr("requests.get", make_requests_get_mock("sample_settrackingpackageinfos.xml"))
sales_management = SalesManagement(ShibaConnection("test", "test", "https://ws.sandbox.priceminister.com"))
obj = sales_management.set_tracking_package_infos("1337", "UPS", "0000000000")
assert obj.content.tag == "setshippingpackageinfosresult"
obj = None
try:
obj = sales_management.set_tracking_package_infos("1337", "Autre", "0000000000")
except ShibaCallingError:
pass
assert obj is None
示例9: test_confirm_preorder
def test_confirm_preorder(monkeypatch):
"""confirm_preorder on an advert. Testing internal error catching as well."""
monkeypatch.setattr("requests.get", make_requests_get_mock("sample_confirmpreorder.xml"))
sales_management = SalesManagement(ShibaConnection("test", "test", "https://ws.sandbox.priceminister.com"))
obj = sales_management.confirm_preorder("1337", 1)
assert obj.content.tag == "confirmpreorder"
obj = None
try:
obj = sales_management.confirm_preorder("1337", -8)
except ShibaCallingError:
pass
assert obj is None
示例10: test_accept_sale
def test_accept_sale(monkeypatch):
"""Only fail result, as accepting an actual sale is not simulable"""
monkeypatch.setattr('requests.get', make_requests_get_mock('sample_accept_sale.xml'))
sales_management = SalesManagement(ShibaConnection("test", "test", "https://ws.fr.shopping.rakuten.com"))
itemid = "000000"
obj = None
try:
obj = sales_management.accept_sale(itemid)
except ShibaServiceError:
pass
except ShibaParameterError:
pass
assert obj is not None
示例11: test_refuse_sale
def test_refuse_sale(monkeypatch):
"""Only fail result, as refusing an actual sale is not simulable"""
monkeypatch.setattr("requests.get", make_requests_get_mock("sample_accept_sale.xml"))
sales_management = SalesManagement(ShibaConnection("test", "test", "https://ws.sandbox.priceminister.com"))
itemid = "000000"
obj = None
try:
obj = sales_management.refuse_sale(itemid)
except ShibaServiceError:
pass
except ShibaParameterError:
pass
assert obj is not None
示例12: test_get_current_sales
def test_get_current_sales(monkeypatch):
"""get_current_sales test, on variable parameters, plus some fail results"""
monkeypatch.setattr("requests.get", make_requests_get_mock("sample_getcurrentsales.xml"))
sales_management = SalesManagement(ShibaConnection("test", "test", "https://ws.sandbox.priceminister.com"))
obj = sales_management.get_current_sales()
assert "getcurrentsalesresult" in obj.content.tag
assert not obj.content.request.ispendingpreorder
try:
sales_management.get_current_sales(ispendingpreorder="n")
except ShibaCallingError:
pass
obj = sales_management.get_current_sales(purchasedate="WRONGDATE")
for elem in obj.content.response:
assert elem.tag != "purchasedate"
示例13: test_confirm_preorder
def test_confirm_preorder(connection):
"""confirm_preorder on an unknown advert, must fail. Testing internal error catching as well."""
sales_management = SalesManagement(connection)
obj = None
try:
obj = sales_management.confirm_preorder("1337", 1)
except ShibaParameterError:
pass
assert obj is None
try:
obj = sales_management.confirm_preorder("1337", -8)
except ShibaCallingError:
pass
assert obj is None
示例14: test_set_tracking_package_infos
def test_set_tracking_package_infos(connection):
"""set_tracking_package_infos on an unknown product, must fail. Testing internal error catching as well."""
sales_management = SalesManagement(connection)
obj = None
try:
obj = sales_management.set_tracking_package_infos("1337", "UPS", "0000000000")
except ShibaParameterError:
pass
assert obj is None
try:
obj = sales_management.set_tracking_package_infos("1337", "Autre", "0000000000")
except ShibaCallingError:
pass
assert obj is None
示例15: setUp
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"))