def recovery_measures(request, domain, build_id): app_id = get_app_cached(domain, build_id).master_id response = { "latest_apk_version": get_default_build_spec().version, "latest_ccz_version": get_latest_released_app_version(domain, app_id), "app_id": request.GET.get('app_id'), # passed through unchanged } measures = get_recovery_measures_cached(domain, app_id) if measures: response["recovery_measures"] = measures return JsonResponse(response)
def turn_on_secure_submissions_for_all_apps(domain): for app in get_apps_in_domain(domain): save = False if app.application_version == APP_V1: continue if not app.build_version or app.build_version < LooseVersion('2.8'): app.build_spec = get_default_build_spec() save = True if not app.secure_submissions: app.secure_submissions = True save = True if save: app.save()
def get_latest_apk_version(self): from corehq.apps.app_manager.models import LATEST_APK_VALUE from corehq.apps.builds.models import BuildSpec from corehq.apps.builds.utils import get_default_build_spec if self.app.global_app_config.apk_prompt == "off": return {} else: configured_version = self.app.global_app_config.apk_version if configured_version == LATEST_APK_VALUE: value = get_default_build_spec().version else: value = BuildSpec.from_string(configured_version).version force = self.app.global_app_config.apk_prompt == "forced" return {"value": value, "force": force}
def test_apk_prompt(self): from corehq.apps.builds.utils import get_default_build_spec latest_apk = get_default_build_spec().version test_cases = [ ('off', {}), ('on', {'value': latest_apk, 'force': False}), ('forced', {'value': latest_apk, 'force': True}), ] for config, response in test_cases: app_config = self.app.global_app_config app_config.apk_prompt = config app_config.save() config = GlobalAppConfig.by_app_id(self.domain, self.app.origin_id) self.assertEqual( config.get_latest_apk_version(), response )
def test_apk_prompt(self): from corehq.apps.builds.utils import get_default_build_spec latest_apk = get_default_build_spec().version test_cases = [ ('off', {}), ('on', {'value': latest_apk, 'force': False}), ('forced', {'value': latest_apk, 'force': True}), ] for config, response in test_cases: app_config = self.app.global_app_config app_config.apk_prompt = config app_config.save() latest_info = LatestAppInfo(self.app.master_id, self.domain) self.assertEquals( latest_info.get_latest_apk_version(), response )
def test_apk_prompt(self): from corehq.apps.builds.utils import get_default_build_spec latest_apk = get_default_build_spec().version test_cases = [ ('off', {}), ('on', {'value': latest_apk, 'force': False}), ('forced', {'value': latest_apk, 'force': True}), ] for config, response in test_cases: app_config = self.app.global_app_config app_config.apk_prompt = config app_config.save() latest_info = LatestAppInfo(self.app.master_id, self.domain) self.assertEqual( latest_info.get_latest_apk_version(), response )