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


Python EWSGhanaConfig.save方法代码示例

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


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

示例1: setUp

# 需要导入模块: from custom.ewsghana.models import EWSGhanaConfig [as 别名]
# 或者: from custom.ewsghana.models.EWSGhanaConfig import save [as 别名]
    def setUp(self):
        self.endpoint = MockEndpoint('http://test-api.com/', 'dummy', 'dummy')
        self.stock_api_object = MockEWSStockDataSynchronization(TEST_DOMAIN, self.endpoint)
        self.datapath = os.path.join(os.path.dirname(__file__), 'data')
        initial_bootstrap(TEST_DOMAIN)
        self.api_object = EWSApi(TEST_DOMAIN, self.endpoint)
        self.api_object.prepare_commtrack_config()
        config = EWSGhanaConfig()
        config.domain = TEST_DOMAIN
        config.enabled = True
        config.all_stock_data = True
        config.password = 'dummy'
        config.username = 'dummy'
        config.url = 'http://test-api.com/'
        config.save()
        l1 = Location(
            name='Test location 1',
            external_id='3445',
            location_type='Hospital',
            domain=TEST_DOMAIN
        )

        l2 = Location(
            name='Test location 2',
            external_id='4407',
            location_type='Hospital',
            domain=TEST_DOMAIN
        )

        l1.save()
        l2.save()

        with open(os.path.join(self.datapath, 'sample_products.json')) as f:
            for product_json in json.loads(f.read()):
                self.api_object.product_sync(Product(product_json))
开发者ID:ansarbek,项目名称:commcare-hq,代码行数:37,代码来源:test_stock_data_sync.py

示例2: prepare_domain

# 需要导入模块: from custom.ewsghana.models import EWSGhanaConfig [as 别名]
# 或者: from custom.ewsghana.models.EWSGhanaConfig import save [as 别名]
def prepare_domain(domain_name):
    domain = create_domain(domain_name)
    domain.convert_to_commtrack()

    domain.default_sms_backend_id = TEST_BACKEND
    domain.save()

    def _make_loc_type(name, administrative=False, parent_type=None):
        return LocationType.objects.get_or_create(
            domain=domain_name,
            name=name,
            administrative=administrative,
            parent_type=parent_type,
        )[0]

    country = _make_loc_type(name="country", administrative=True)
    _make_loc_type(name="Central Medical Store", parent_type=country)
    _make_loc_type(name="Teaching Hospital", parent_type=country)

    region = _make_loc_type(name="region", administrative=True, parent_type=country)
    _make_loc_type(name="Regional Medical Store", parent_type=region)
    _make_loc_type(name="Regional Hospital", parent_type=region)

    district = _make_loc_type(name="district", administrative=True, parent_type=region)
    _make_loc_type(name="Clinic", parent_type=district)
    _make_loc_type(name="District Hospital", parent_type=district)
    _make_loc_type(name="Health Centre", parent_type=district)
    _make_loc_type(name="CHPS Facility", parent_type=district)
    _make_loc_type(name="Hospital", parent_type=district)
    _make_loc_type(name="Psychiatric Hospital", parent_type=district)
    _make_loc_type(name="Polyclinic", parent_type=district)
    _make_loc_type(name="facility", parent_type=district)

    generator.instantiate_accounting_for_tests()
    account = BillingAccount.get_or_create_account_by_domain(
        domain.name,
        created_by="automated-test",
    )[0]
    plan = DefaultProductPlan.get_default_plan_by_domain(
        domain, edition=SoftwarePlanEdition.ADVANCED
    )
    subscription = Subscription.new_domain_subscription(
        account,
        domain.name,
        plan
    )
    subscription.is_active = True
    subscription.save()
    ews_config = EWSGhanaConfig(enabled=True, domain=domain.name)
    ews_config.save()
    return domain
开发者ID:nnestle,项目名称:commcare-hq,代码行数:53,代码来源:utils.py


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