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


Python Store.select_by_id方法代码示例

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


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

示例1: test_insert_store_return_with_new_store_id

# 需要导入模块: from geoprocessing.business_logic.business_objects.store import Store [as 别名]
# 或者: from geoprocessing.business_logic.business_objects.store.Store import select_by_id [as 别名]
    def test_insert_store_return_with_new_store_id(self):
        try:
            # create fake company and address
            company_id = insert_test_company()
            address_id = insert_test_address(-40, 40)

            # create fake store
            store = Store.standard_init(None, company_id, address_id, "111-111-1111", "UNITTESTSTOREFORMAT", "UNITTESTCOMPANYGENERAGEDSTORENUMBER", "UNITETESTNOTE", None, None, "2012-02-02", None)

            # save store, which should initialize itself with the store_id and the change type
            store = self._SQL_data_repository.insert_store_return_with_new_store_id(store)

            # verify ID is set
            self.assertIsNotNone(store.store_id)

            # select store and verify fields
            store = Store.select_by_id(store.store_id)
            self.assertEqual(store.company_id, company_id)
            self.assertEqual(store.address_id, address_id)
            self.assertEqual(store.phone_number, "111-111-1111")
            self.assertEqual(store.note, "UNITETESTNOTE")
            self.assertEqual(store.store_format, "UNITTESTSTOREFORMAT")
            self.assertEqual(store.company_generated_store_number, "UNITTESTCOMPANYGENERAGEDSTORENUMBER")
            self.assertIsNone(store._opened_date)
            self.assertIsNone(store._closed_date)
            self.assertEqual(store._assumed_opened_date, datetime(2012, 2, 2))
            self.assertIsNone(store._assumed_closed_date)
        finally:
            delete_test_store(store.store_id)
            delete_test_address(address_id)
            delete_test_company(company_id)
开发者ID:erezrubinstein,项目名称:aa,代码行数:33,代码来源:test_store_data_access.py

示例2: test_update_store

# 需要导入模块: from geoprocessing.business_logic.business_objects.store import Store [as 别名]
# 或者: from geoprocessing.business_logic.business_objects.store.Store import select_by_id [as 别名]
    def test_update_store(self):
        try:
            # create test store
            company_id = insert_test_company()
            address_id = insert_test_address(-10.24, 10.24)
            store_id = insert_test_store(company_id, address_id)

            # select the store and update the note, format fields
            store = Store.select_by_id(store_id)
            store.note = "UNITTEST-NOTE-UPDATED"
            store.store_format = "UNITTEST-STOREFORAMT-UPDATED"

            # update the store
            self._SQL_data_repository.update_store(store)

            # re-select the store and verify that everything was updated properly
            store_updated = Store.select_by_id(store_id)
            self.assertEqual(store.note, "UNITTEST-NOTE-UPDATED")
            self.assertEqual(store.store_format, "UNITTEST-STOREFORAMT-UPDATED")
        finally:
            delete_test_store(store_id)
            delete_test_address(address_id)
            delete_test_company(company_id)
开发者ID:erezrubinstein,项目名称:aa,代码行数:25,代码来源:test_store_data_access.py


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