当前位置: 首页>>代码示例>>Python>>正文


Python SalesManagement.cancel_item方法代码示例

本文整理汇总了Python中shiba.salesmanagement.SalesManagement.cancel_item方法的典型用法代码示例。如果您正苦于以下问题:Python SalesManagement.cancel_item方法的具体用法?Python SalesManagement.cancel_item怎么用?Python SalesManagement.cancel_item使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在shiba.salesmanagement.SalesManagement的用法示例。


在下文中一共展示了SalesManagement.cancel_item方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_cancel_item

# 需要导入模块: from shiba.salesmanagement import SalesManagement [as 别名]
# 或者: from shiba.salesmanagement.SalesManagement import cancel_item [as 别名]
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
开发者ID:tboulogne,项目名称:shiba,代码行数:11,代码来源:test_salesmanagement.py

示例2: test_cancel_item

# 需要导入模块: from shiba.salesmanagement import SalesManagement [as 别名]
# 或者: from shiba.salesmanagement.SalesManagement import cancel_item [as 别名]
def test_cancel_item(monkeypatch):
    """cancel_item test"""
    monkeypatch.setattr("requests.get", make_requests_get_mock("sample_cancelitem.xml"))
    sales_management = SalesManagement(ShibaConnection("test", "test", "https://ws.sandbox.priceminister.com"))
    obj = sales_management.cancel_item("1337", "comment")
    assert obj.content.tag == "cancelitemresult"
开发者ID:Phylante,项目名称:shiba,代码行数:8,代码来源:test_salesmanagement.py

示例3: SalesManagementTest

# 需要导入模块: from shiba.salesmanagement import SalesManagement [as 别名]
# 或者: from shiba.salesmanagement.SalesManagement import cancel_item [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)
#.........这里部分代码省略.........
开发者ID:Phylante,项目名称:shiba,代码行数:103,代码来源:test_salesmanagement.py


注:本文中的shiba.salesmanagement.SalesManagement.cancel_item方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。