def _do_test_raw_webextension(manifest, listed=True): err = ErrorBundle(listed=listed) manifest = ManifestJsonParser(err, manifest) err.save_resource('has_manifest_json', True) err.save_resource('manifest_json', manifest) targetapp.test_targetedapplications(err) return err
def _do_test_raw(rdf, listed=True, overrides=None): err = ErrorBundle(listed=listed) err.overrides = overrides rdf = RDFParser(err, rdf.strip()) err.save_resource('has_install_rdf', True) err.save_resource('install_rdf', rdf) targetapp.test_targetedapplications(err) return err
def _do_test_raw(rdf, listed=True, overrides=None): err = ErrorBundle(listed=listed) err.overrides = overrides rdf = RDFParser(rdf.strip()) err.save_resource("has_install_rdf", True) err.save_resource("install_rdf", rdf) targetapp.test_targetedapplications(err) print err.print_summary() return err
def test_manifest_ordering(): err = ErrorBundle(listed=True) manifest = ManifestJsonParser(err, INVALID_MANIFEST_JSON) err.save_resource('has_manifest_json', True) err.save_resource('manifest_json', manifest) rdf = RDFParser(err, VALID_INSTALL_RDF.strip()) err.save_resource('has_install_rdf', True) err.save_resource('install_rdf', rdf) targetapp.test_targetedapplications(err) assert not err.failed()
def test_has_installrdfs(): """Tests that install.rdf files are present.""" err = ErrorBundle(None, True) # Test package to make sure has_install_rdf is set to True. assert targetapp.test_targetedapplications(err, {}, None) is None
def test_has_installrdfs(): """Tests that install.rdf files are present.""" err = ErrorBundle() # Test package to make sure has_install_rdf is set to True. assert targetapp.test_targetedapplications(err, None) is None # The supported versions list must be empty or other tests will fail. assert err.supported_versions == {}
def test_missing_installrdfs_are_handled(): """ Tests that install.rdf files are present and supported_versions is set to an empty dict if an install.rdf is not found. """ err = ErrorBundle() # This is the default, but I'm specifying it for clarity of purpose. err.supported_versions = None # Test package to make sure has_install_rdf is set to True. assert targetapp.test_targetedapplications(err, None) is None # The supported versions list must be empty or other tests will fail. assert err.supported_versions == {}
def test_supported_versions_not_overwritten(): """ Test that supported_versions is not overwritten in subpackages (JARs) when install.rdf files are tested for. This could otherwise happen because the targetApplication tests previously gave an empty dict to supported_versions in order to ensure a valid state when testing for version support. If the supported_versions field in an error bundle is None, it represents that the list of targeted applications has not been parsed yet. Setting it to an empty dict prevents exceptions later on by stating that no supported versions are available. If this didn't happen, it would be assumed that compatibility (version-dependent) tests were reached before the install.rdf was parsed. That would indicate that the validation process has encountered an error elsewhere. """ err = ErrorBundle() orig_value = err.supported_versions = {"foo": ["bar"]} # Test package to make sure has_install_rdf is set to True. assert targetapp.test_targetedapplications(err, None) is None # The supported versions list must match what was specified assert err.supported_versions is orig_value