def test_no_min_appversion(self, validate): validate.return_value = json.dumps(no_op_validation) self.version.apps.all().delete() job = self.create_job(target_version=self.appversion('3.7a4')) res = self.create_result(job, self.create_file(), **{}) tasks.bulk_validate_file(res.id) assert validate.called eq_(validate.call_args[1]['overrides'], {'targetapp_maxVersion': {amo.FIREFOX.guid: '3.7a4'}})
def test_merge_with_compat_summary(self, run_validator): data = { "errors": 1, "detected_type": "extension", "success": False, "warnings": 50, "notices": 1, "ending_tier": 5, "messages": [ { "description": "A global function was called ...", "tier": 3, "message": "Global called in dangerous manner", "uid": "de93a48831454e0b9d965642f6d6bf8f", "id": [], "compatibility_type": None, "for_appversions": None, "type": "warning", }, { "description": ("...no longer indicate the language " "of Firefox's UI..."), "tier": 5, "message": "navigator.language may not behave as expected", "uid": "f44c1930887c4d9e8bd2403d4fe0253a", "id": [], "compatibility_type": "error", "for_appversions": { "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}": ["4.2a1pre", "5.0a2", "6.0a1"] }, "type": "warning" }], "compatibility_summary": { "notices": 1, "errors": 6, "warnings": 0 }, "metadata": { "version": "1.0", "name": "FastestFox", "id": "<id>" } } run_validator.return_value = json.dumps(data) res = self.create_result(self.create_job(), self.create_file(), **{}) tasks.bulk_validate_file(res.id) assert run_validator.called res = ValidationResult.objects.get(pk=res.pk) eq_(res.errors, data['errors'] + data['compatibility_summary']['errors']) eq_(res.warnings, data['warnings'] + data['compatibility_summary']['warnings']) eq_(res.notices, data['notices'] + data['compatibility_summary']['notices'])
def test_validate_all_tiers(self, run_validator): run_validator.return_value = json.dumps(no_op_validation) res = self.create_result(self.create_job(), self.create_file(), **{}) tasks.bulk_validate_file(res.id) assert run_validator.called eq_(run_validator.call_args[1]['test_all_tiers'], True)
def test_merge_with_compat_summary(self, run_validator): data = { "errors": 1, "detected_type": "extension", "success": False, "warnings": 50, "notices": 1, "ending_tier": 5, "messages": [{ "description": "A global function was called ...", "tier": 3, "message": "Global called in dangerous manner", "uid": "de93a48831454e0b9d965642f6d6bf8f", "compatibility_type": None, "for_appversions": None, "type": "warning", }, { "description": ("...no longer indicate the language " "of Firefox's UI..."), "tier": 5, "message": "navigator.language may not behave as expected", "uid": "f44c1930887c4d9e8bd2403d4fe0253a", "compatibility_type": "error", "for_appversions": { "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}": ["4.2a1pre", "5.0a2", "6.0a1"] }, "type": "warning" }], "compatibility_summary": { "notices": 1, "errors": 6, "warnings": 0 }, "metadata": { "version": "1.0", "name": "FastestFox", "id": "<id>" } } run_validator.return_value = json.dumps(data) res = self.create_result(self.create_job(), self.create_file(), **{}) tasks.bulk_validate_file(res.id) assert run_validator.called res = ValidationResult.objects.get(pk=res.pk) eq_(res.errors, data['errors'] + data['compatibility_summary']['errors']) eq_(res.warnings, data['warnings'] + data['compatibility_summary']['warnings']) eq_(res.notices, data['notices'] + data['compatibility_summary']['notices'])