本文整理汇总了Python中custom.ilsgateway.models.ILSGatewayConfig.save方法的典型用法代码示例。如果您正苦于以下问题:Python ILSGatewayConfig.save方法的具体用法?Python ILSGatewayConfig.save怎么用?Python ILSGatewayConfig.save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类custom.ilsgateway.models.ILSGatewayConfig
的用法示例。
在下文中一共展示了ILSGatewayConfig.save方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: from custom.ilsgateway.models import ILSGatewayConfig [as 别名]
# 或者: from custom.ilsgateway.models.ILSGatewayConfig import save [as 别名]
def setUp(self):
self.endpoint = MockEndpoint("http://test-api.com/", "dummy", "dummy")
self.stock_api_object = MockILSStockDataSynchronization(TEST_DOMAIN, self.endpoint)
self.datapath = os.path.join(os.path.dirname(__file__), "data")
initial_bootstrap(TEST_DOMAIN)
self.api_object = ILSGatewayAPI(TEST_DOMAIN, self.endpoint)
self.api_object.prepare_commtrack_config()
config = ILSGatewayConfig()
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="FACILITY", domain=TEST_DOMAIN)
l2 = Location(name="Test location 2", external_id="4407", location_type="FACILITY", domain=TEST_DOMAIN)
l1.save()
l2.save()
SupplyPointCase.create_from_location(TEST_DOMAIN, l1)
SupplyPointCase.create_from_location(TEST_DOMAIN, l2)
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))
StockTransaction.objects.all().delete()
示例2: setUp
# 需要导入模块: from custom.ilsgateway.models import ILSGatewayConfig [as 别名]
# 或者: from custom.ilsgateway.models.ILSGatewayConfig import save [as 别名]
def setUp(self):
self.datapath = os.path.join(os.path.dirname(__file__), 'data')
initial_bootstrap(TEST_DOMAIN)
config = ILSGatewayConfig()
config.domain = TEST_DOMAIN
config.enabled = True
config.password = 'dummy'
config.username = 'dummy'
config.url = 'http://test-api.com/'
config.save()
for product in Product.by_domain(TEST_DOMAIN):
product.delete()
示例3: prepare_domain
# 需要导入模块: from custom.ilsgateway.models import ILSGatewayConfig [as 别名]
# 或者: from custom.ilsgateway.models.ILSGatewayConfig import save [as 别名]
def prepare_domain(domain_name):
from corehq.apps.commtrack.tests.util import bootstrap_domain
domain = bootstrap_domain(domain_name)
previous = None
for name, administrative in [
("MOHSW", True),
("MSDZONE", True),
("REGION", True),
("DISTRICT", True),
("FACILITY", False)
]:
previous, _ = LocationType.objects.get_or_create(
domain=domain_name,
name=name,
parent_type=previous,
administrative=administrative,
)
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
)
commtrack = domain.commtrack_settings
commtrack.actions.append(
CommtrackActionConfig(action='receipts',
keyword='delivered',
caption='Delivered')
)
commtrack.save()
subscription = Subscription.new_domain_subscription(
account,
domain.name,
plan
)
subscription.is_active = True
subscription.save()
ils_config = ILSGatewayConfig(enabled=True, domain=domain.name, all_stock_data=True)
ils_config.save()
fields_definition = CustomDataFieldsDefinition.get_or_create(domain.name, 'LocationFields')
fields_definition.fields.append(CustomDataField(
slug='group',
label='Group',
is_required=False,
choices=['A', 'B', 'C'],
is_multiple_choice=False
))
fields_definition.save()
return domain
示例4: setUpClass
# 需要导入模块: from custom.ilsgateway.models import ILSGatewayConfig [as 别名]
# 或者: from custom.ilsgateway.models.ILSGatewayConfig import save [as 别名]
def setUpClass(cls):
cls.datapath = os.path.join(os.path.dirname(__file__), 'data')
cls.sms_backend, cls.sms_backend_mapping = setup_default_sms_test_backend()
initial_bootstrap(TEST_DOMAIN)
config = ILSGatewayConfig()
config.domain = TEST_DOMAIN
config.enabled = True
config.password = 'dummy'
config.username = 'dummy'
config.url = 'http://test-api.com/'
config.save()
for product in Product.by_domain(TEST_DOMAIN):
product.delete()
示例5: setUp
# 需要导入模块: from custom.ilsgateway.models import ILSGatewayConfig [as 别名]
# 或者: from custom.ilsgateway.models.ILSGatewayConfig import save [as 别名]
def setUp(self):
self.datapath = os.path.join(os.path.dirname(__file__), 'data')
initial_bootstrap(TEST_DOMAIN)
self.sms_backend = TestSMSBackend(name="MOBILE_BACKEND_TEST", is_global=True)
self.sms_backend._id = self.sms_backend.name
self.sms_backend.save()
config = ILSGatewayConfig()
config.domain = TEST_DOMAIN
config.enabled = True
config.password = 'dummy'
config.username = 'dummy'
config.url = 'http://test-api.com/'
config.save()
for product in Product.by_domain(TEST_DOMAIN):
product.delete()
示例6: setUp
# 需要导入模块: from custom.ilsgateway.models import ILSGatewayConfig [as 别名]
# 或者: from custom.ilsgateway.models.ILSGatewayConfig import save [as 别名]
def setUp(self):
self.endpoint = MockEndpoint('http://test-api.com/', 'dummy', 'dummy')
self.api_object = ILSGatewayAPI(TEST_DOMAIN, self.endpoint)
self.datapath = os.path.join(os.path.dirname(__file__), 'data')
initial_bootstrap(TEST_DOMAIN)
config = ILSGatewayConfig(
domain=TEST_DOMAIN, enabled=True, all_stock_data=True, password='dummy', username='dummy',
url='http//test-api.com/'
)
config.save()
with open(os.path.join(self.datapath, 'sample_locations.json')) as f:
location = Loc(**json.loads(f.read())[1])
self.api_object.prepare_commtrack_config()
self.api_object.location_sync(location)
for user in WebUser.by_domain(TEST_DOMAIN):
user.delete()
示例7: prepare_domain
# 需要导入模块: from custom.ilsgateway.models import ILSGatewayConfig [as 别名]
# 或者: from custom.ilsgateway.models.ILSGatewayConfig import save [as 别名]
def prepare_domain(domain_name):
from corehq.apps.commtrack.tests import bootstrap_domain
domain = bootstrap_domain(domain_name)
previous = None
for name, administrative in [
("MOHSW", True),
("REGION", True),
("DISTRICT", True),
("FACILITY", False)
]:
previous, _ = LocationType.objects.get_or_create(
domain=domain_name,
name=name,
parent_type=previous,
administrative=administrative,
)
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
)
commtrack = domain.commtrack_settings
commtrack.actions.append(
CommtrackActionConfig(action='receipts',
keyword='delivered',
caption='Delivered')
)
commtrack.save()
subscription = Subscription.new_domain_subscription(
account,
domain.name,
plan
)
subscription.is_active = True
subscription.save()
ils_config = ILSGatewayConfig(enabled=True, domain=domain.name)
ils_config.save()
return domain