Пример #1
0
    def _test_plan_versions_ensured(self, bootstrap_config):
        ensure_plans(bootstrap_config, True, apps)
        for (edition, is_trial,
             has_report_builder), config in bootstrap_config.items():
            software_plan_version = DefaultProductPlan.get_default_plan_version(
                edition=edition,
                is_trial=is_trial,
                is_report_builder_enabled=has_report_builder)

            self.assertEqual(software_plan_version.role.slug, config['role'])

            self.assertEqual(software_plan_version.product_rate.monthly_fee,
                             config['product_rate_monthly_fee'])

            self.assertEqual(
                software_plan_version.user_limit,
                config['feature_rates'][FeatureType.USER]['monthly_limit'])
            self.assertEqual(
                software_plan_version.user_feature.per_excess_fee,
                config['feature_rates'][FeatureType.USER]['per_excess_fee'])

            sms_feature_rate = software_plan_version.feature_rates.get(
                feature__feature_type=FeatureType.SMS)
            self.assertEqual(
                sms_feature_rate.monthly_limit,
                config['feature_rates'][FeatureType.SMS]['monthly_limit'])
            self.assertEqual(sms_feature_rate.per_excess_fee, 0)
Пример #2
0
    def _test_plan_versions_ensured(self, bootstrap_config):
        ensure_plans(bootstrap_config, True, apps)
        for (edition, is_trial, has_report_builder), config in six.iteritems(bootstrap_config):
            software_plan_version = DefaultProductPlan.get_default_plan_version(
                edition=edition, is_trial=is_trial, is_report_builder_enabled=has_report_builder
            )

            self.assertEqual(software_plan_version.role.slug, config['role'])

            self.assertEqual(software_plan_version.product_rate.monthly_fee, config['product_rate_monthly_fee'])

            self.assertEqual(
                software_plan_version.user_limit,
                config['feature_rates'][FeatureType.USER]['monthly_limit']
            )
            self.assertEqual(
                software_plan_version.user_feature.per_excess_fee,
                config['feature_rates'][FeatureType.USER]['per_excess_fee']
            )

            sms_feature_rate = software_plan_version.feature_rates.get(feature__feature_type=FeatureType.SMS)
            self.assertEqual(
                sms_feature_rate.monthly_limit,
                config['feature_rates'][FeatureType.SMS]['monthly_limit']
            )
            self.assertEqual(sms_feature_rate.per_excess_fee, 0)
Пример #3
0
def bootstrap_test_plans():
    DefaultProductPlan.objects.all().delete()
    SoftwarePlanVersion.objects.all().delete()
    SoftwarePlan.objects.all().delete()
    SoftwareProductRate.objects.all().delete()
    FeatureRate.objects.all().delete()
    Feature.objects.all().delete()
    ensure_plans(BOOTSTRAP_CONFIG_TESTING, verbose=False, apps=apps)
def _bootstrap_new_community_plan_versions(apps, schema_editor):
    ensure_plans(
        edition_to_role=BOOTSTRAP_EDITION_TO_ROLE,
        edition_to_product_rate=BOOTSTRAP_PRODUCT_RATES,
        edition_to_feature_rate=BOOTSTRAP_FEATURE_RATES,
        feature_types=FEATURE_TYPES,
        product_types=PRODUCT_TYPES,
        dry_run=False, verbose=True, apps=apps,
    )
def cchq_new_editions_bootstrap(apps, schema_editor):
    ensure_plans(
        edition_to_role=BOOTSTRAP_EDITION_TO_ROLE,
        edition_to_product_rate=BOOTSTRAP_PRODUCT_RATES,
        edition_to_feature_rate=BOOTSTRAP_FEATURE_RATES,
        feature_types=FEATURE_TYPES,
        product_types=PRODUCT_TYPES,
        dry_run=False, verbose=True, apps=apps,
    )
Пример #6
0
    def handle(self, dry_run=False, verbose=False, testing=False, *args, **options):
        logger.info('Bootstrapping standard plans. Custom plans will have to be created via the admin UIs.')

        if testing:
            logger.info("Initializing Plans and Roles for Testing")
            config = BOOTSTRAP_CONFIG_TESTING
        else:
            config = BOOTSTRAP_CONFIG

        ensure_plans(config, dry_run=dry_run, verbose=verbose, apps=default_apps)
Пример #7
0
    def handle(self, dry_run=False, verbose=False, testing=False, *args, **options):
        log_accounting_info(
            'Bootstrapping standard plans. Custom plans will have to be created via the admin UIs.'
        )

        if testing:
            log_accounting_info("Initializing Plans and Roles for Testing")
            config = BOOTSTRAP_CONFIG_TESTING
        else:
            config = BOOTSTRAP_CONFIG

        ensure_plans(config, dry_run=dry_run, verbose=verbose, apps=default_apps)
Пример #8
0
def bootstrap_accounting():
    from ..bootstrap.config.enterprise import BOOTSTRAP_CONFIG as enterprise_config
    from ..bootstrap.config.report_builder_v0 import BOOTSTRAP_CONFIG as report_builder_config
    from ..bootstrap.config.resellers_and_managed_hosting import BOOTSTRAP_CONFIG as resellers_config
    from ..bootstrap.config.user_buckets_jan_2017 import BOOTSTRAP_CONFIG as self_service_config
    from ..bootstrap.config.new_plans_dec_2019 import BOOTSTRAP_CONFIG as new_plans_dec_2019
    call_command('cchq_prbac_bootstrap')
    pricing_config = self_service_config
    pricing_config.update(enterprise_config)
    pricing_config.update(report_builder_config)
    pricing_config.update(resellers_config)
    pricing_config.update(new_plans_dec_2019)
    ensure_plans(pricing_config, verbose=True, apps=apps)
Пример #9
0
def bootstrap_test_software_plan_versions():
    ensure_plans(BOOTSTRAP_CONFIG_TESTING, verbose=False, apps=apps)
Пример #10
0
def cchq_software_plan_bootstrap(apps, schema_editor):
    ensure_plans(BOOTSTRAP_CONFIG, dry_run=False, verbose=True, apps=apps)
def _bootstrap_new_community_plan_versions(apps, schema_editor):
    ensure_plans(BOOTSTRAP_CONFIG, dry_run=False, verbose=True, apps=apps)
def _cchq_software_plan_update(apps, schema_editor):
    ensure_plans(report_builder_config, verbose=True, apps=apps)
Пример #13
0
def _bootstrap_with_updated_user_buckets(apps, schema_editor):
    ensure_plans(BOOTSTRAP_CONFIG, dry_run=False, verbose=True, apps=apps)
def _cchq_software_plan_bootstrap(apps, schema_editor):
    pricing_config = self_service_config
    pricing_config.update(enterprise_config)
    pricing_config.update(report_builder_config)
    pricing_config.update(resellers_config)
    ensure_plans(pricing_config, verbose=True, apps=apps)
def _cchq_software_plan_bootstrap(apps, schema_editor):
    pricing_config = self_service_config
    pricing_config.update(enterprise_config)
    pricing_config.update(report_builder_config)
    pricing_config.update(resellers_config)
    ensure_plans(pricing_config, verbose=True, apps=apps)
def bootstrap_report_builder_plans(apps, schema_editor):
    ensure_plans(BOOTSTRAP_CONFIG, dry_run=False, verbose=True, apps=apps)
def _cchq_software_plan_update(apps, schema_editor):
    ensure_plans(report_builder_config, verbose=True, apps=apps)
def _bootstrap_new_community_role(apps, schema_editor):
    ensure_plans(COMMUNITY_V1_BOOTSTRAP_CONFIG, dry_run=False, verbose=True, apps=apps)
def cchq_software_plan_bootstrap(apps, schema_editor):
    ensure_plans(ORIGINAL_BOOTSTRAP_CONFIG, dry_run=False, verbose=True, apps=apps)
def _bootstrap_new_standard_pricing(apps, schema_editor):
    ensure_plans(BOOTSTRAP_CONFIG, verbose=True, apps=apps)
Пример #21
0
def _ensure_new_software_plans(apps, schema_editor):
    ensure_plans(new_plans_config, verbose=True, apps=apps)
def _bootstrap_new_community_plan_versions(apps, schema_editor):
    ensure_plans(BOOTSTRAP_CONFIG, dry_run=False, verbose=True, apps=apps)
def cchq_new_editions_bootstrap(apps, schema_editor):
    ensure_plans(BOOTSTRAP_CONFIG, dry_run=False, verbose=True, apps=apps)