Ejemplo n.º 1
0
def test_open():
    """Open a chrome file and ensure that data can be pulled from it."""

    xpi = MockXPI(
        {'chrome.manifest': 'tests/resources/chromemanifest/chrome.manifest'})

    manifest = ChromeManifest(xpi, 'chrome.manifest')
    assert manifest is not None

    g_obj = list(manifest.get_entries('subject', 'predicate'))

    assert len(g_obj) == 1
    assert g_obj[0]['args'][1] == 'object'

    sub_locale = list(manifest.get_entries('locale'))
    assert len(sub_locale) == 2
Ejemplo n.º 2
0
def test_open():
    """Open a chrome file and ensure that data can be pulled from it."""

    xpi = MockXPI({
        'chrome.manifest': 'tests/resources/chromemanifest/chrome.manifest'})

    manifest = ChromeManifest(xpi, 'chrome.manifest')
    assert manifest is not None

    g_obj = list(manifest.get_entries('subject', 'predicate'))

    assert len(g_obj) == 1
    assert g_obj[0]['args'][1] == 'object'

    sub_locale = list(manifest.get_entries('locale'))
    assert len(sub_locale) == 2
Ejemplo n.º 3
0
def _list_locales(err, xpi_package=None):
    'Returns a raw list of locales from chrome.manifest'

    chrome = None
    if xpi_package is not None:
        # Handle a reference XPI
        chrome = ChromeManifest(xpi_package, 'chrome.manifest', err)
    else:
        # Handle the current XPI
        chrome = err.get_resource('chrome.manifest')
    if not chrome:
        return None

    return list(chrome.get_entries('locale'))
Ejemplo n.º 4
0
def _list_locales(err, xpi_package=None):
    'Returns a raw list of locales from chrome.manifest'

    chrome = None
    if xpi_package is not None:
        # Handle a reference XPI
        chrome = ChromeManifest(xpi_package, 'chrome.manifest', err)
    else:
        # Handle the current XPI
        chrome = err.get_resource('chrome.manifest')
    if not chrome:
        return None

    return list(chrome.get_entries('locale'))