当前位置: 首页>>代码示例>>Python>>正文


Python content.test_packed_packages函数代码示例

本文整理汇总了Python中validator.testcases.content.test_packed_packages函数的典型用法代码示例。如果您正苦于以下问题:Python test_packed_packages函数的具体用法?Python test_packed_packages怎么用?Python test_packed_packages使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了test_packed_packages函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_structure

 def test_structure(structure):
     err = ErrorBundle()
     err.supported_versions = {}
     mock_package = MockXPI(structure)
     content.test_packed_packages(err, mock_package)
     print err.print_summary(verbose=True)
     assert err.failed()
开发者ID:l-hedgehog,项目名称:amo-validator,代码行数:7,代码来源:test_content.py

示例2: test_marking_overlays_subdir

def test_marking_overlays_subdir():
    """
    Mark an overlay in a subdirectory, then test that it marks the scripts
    within the overlay. Make sure it properly figures out relative URLs.
    """

    err = ErrorBundle()
    err.supported_versions = {}
    c = ChromeManifest("""
    content ns1 foo/
    overlay chrome://foo chrome://ns1/content/subdir/main.xul
    """, 'chrome.manifest')
    err.save_resource('chrome.manifest', c)
    err.save_resource('chrome.manifest_nopush', c)

    xpi = MockXPI({'foo/subdir/main.xul':
                       'tests/resources/content/script_list.xul'})

    content.test_packed_packages(err, xpi)
    assert not err.failed()

    marked_scripts = err.get_resource('marked_scripts')
    print marked_scripts
    assert marked_scripts

    eq_(marked_scripts, set(['chrome://ns1/subdir/foo.js', 'chrome://ns1/bar.js',
                             'chrome://asdf/foo.js']))
开发者ID:diox,项目名称:amo-validator,代码行数:27,代码来源:test_content_overlays.py

示例3: test_marking_overlays

def test_marking_overlays():
    """
    Mark an overlay, then test that it marks the scripts within the overlay.
    """

    err = ErrorBundle()
    err.supported_versions = {}
    c = ChromeManifest("""
    content ns1 foo/
    overlay chrome://foo chrome://ns1/content/main.xul
    """, "chrome.manifest")
    err.save_resource("chrome.manifest", c)
    err.save_resource("chrome.manifest_nopush", c)

    xpi = MockXPI({"foo/main.xul": "tests/resources/content/script_list.xul"})

    content.test_packed_packages(err, xpi)
    assert not err.failed()

    marked_scripts = err.get_resource("marked_scripts")
    print marked_scripts
    assert marked_scripts

    eq_(marked_scripts, set(["chrome://ns1/foo.js",
                             "chrome://ns1/bar.js",
                             "chrome://asdf/foo.js"]))
开发者ID:Archaeopteryx,项目名称:amo-validator,代码行数:26,代码来源:test_content_overlays.py

示例4: test_validate_libs_in_compat_mode

def test_validate_libs_in_compat_mode():
    xpi = "tests/resources/libraryblacklist/addon_with_mootools.xpi"
    with open(xpi) as data:
        package = XPIManager(data, mode="r", name="addon_with_mootools.xpi")
        err = ErrorBundle(for_appversions=FX9_DEFINITION)
        test_content.test_packed_packages(err, package)
    assert err.get_resource("scripts"), "expected mootools scripts to be marked for proessing"
    eq_(err.get_resource("scripts")[0]["scripts"], set(["content/mootools.js"]))
开发者ID:eviljeff,项目名称:amo-validator,代码行数:8,代码来源:test_libraryblacklist.py

示例5: test_hidden_files

def test_hidden_files(test_input):
    """Tests that hidden files are reported."""

    err = ErrorBundle()
    err.supported_versions = {}
    mock_package = MockXPI(test_input)
    content.test_packed_packages(err, mock_package)
    print err.print_summary(verbose=True)
    assert err.failed()
开发者ID:AutomatedTester,项目名称:amo-validator,代码行数:9,代码来源:test_content.py

示例6: test_validate_libs_in_compat_mode

def test_validate_libs_in_compat_mode():
    xpi = 'tests/resources/libraryblacklist/addon_with_mootools.xpi'
    with open(xpi) as data:
        package = XPIManager(data, mode='r', name='addon_with_mootools.xpi')
        appversions = {FIREFOX_GUID: version_range('firefox',
                                                   '39.0a1', '39.*')}
        err = ErrorBundle(for_appversions=appversions)
        test_content.test_packed_packages(err, package)
    assert err.get_resource('scripts'), (
                    'expected mootools scripts to be marked for proessing')
    assert err.get_resource('scripts')[0]['scripts'] == set(['content/mootools.js'])
开发者ID:AutomatedTester,项目名称:amo-validator,代码行数:11,代码来源:test_libraryblacklist.py

示例7: test_langpack

def test_langpack():
    'Tests a language pack in the content validator.'

    err = ErrorBundle()
    err.supported_versions = {}
    err.detected_type = PACKAGE_LANGPACK
    mock_package = MockXPI({'foo.dtd': 'tests/resources/content/junk.xpi'})

    content.test_packed_packages(err, mock_package)
    content.testendpoint_langpack.assert_expectation('test_unsafe_html', 1)
    content.testendpoint_langpack.assert_expectation('test_unsafe_html', 0,
                                                     'subpackage')
开发者ID:kmaglione,项目名称:amo-validator,代码行数:12,代码来源:test_content.py

示例8: test_jar_case

def test_jar_case():
    """Test that the capitalization of JARs is preserved."""

    err = ErrorBundle()
    mock_package = MockXPI(
        {'foo.JaR': 'tests/resources/packagelayout/ext_blacklist.xpi'})

    content.test_packed_packages(err, mock_package)

    assert err.failed()
    for message in err.errors + err.warnings:
        assert 'JaR' in message['file'][0]
开发者ID:AutomatedTester,项目名称:amo-validator,代码行数:12,代码来源:test_content.py

示例9: test_xpi_tiererror

def test_xpi_tiererror():
    'Tests that tiers are reset when a subpackage is encountered'

    err = ErrorBundle()
    mock_package = MockXPI(
        {'foo.xpi': 'tests/resources/content/subpackage.jar'})

    err.set_tier(2)
    content.test_packed_packages(err, mock_package)
    assert err.errors[0]['tier'] == 1
    assert err.tier == 2
    assert all(x == 1 for x in content.testendpoint_validator.found_tiers)
开发者ID:AutomatedTester,项目名称:amo-validator,代码行数:12,代码来源:test_content.py

示例10: test_skip_blacklisted_file

def test_skip_blacklisted_file():
    """Ensure blacklisted files are skipped for processing."""

    package_data = open("tests/resources/libraryblacklist/errors.xpi")
    package = XPIManager(package_data, mode="r", name="errors.xpi")
    err = ErrorBundle()

    test_content.test_packed_packages(err, package)

    print err.print_summary()
    assert err.notices
    assert not err.failed()
开发者ID:Archaeopteryx,项目名称:amo-validator,代码行数:12,代码来源:test_libraryblacklist.py

示例11: test_xpi_subpackage

def test_xpi_subpackage():
    "XPIs should never be subpackages; only nested extensions"

    err = ErrorBundle()
    err.set_type(PACKAGE_EXTENSION)
    mock_package = MockXPI(
        {"chrome/package.xpi":
             "tests/resources/content/subpackage.jar"})

    content.testendpoint_validator = \
        MockTestEndpoint(("test_package", ))

    result = content.test_packed_packages(
        err,
        mock_package)

    print result
    assert result == 1
    content.testendpoint_validator.assert_expectation(
        "test_package",
        1)
    content.testendpoint_validator.assert_expectation(
        "test_package",
        0,
        "subpackage")
开发者ID:malyshkosergey,项目名称:amo-validator,代码行数:25,代码来源:test_content.py

示例12: test_jar_nonsubpackage

def test_jar_nonsubpackage():
    "Tests XPI files that are not subpackages."

    err = ErrorBundle()
    err.set_type(PACKAGE_MULTI)
    err.save_resource("is_multipackage", True)
    mock_package = MockXPI(
        {"foo.jar":
             "tests/resources/content/subpackage.jar",
         "chrome/bar.jar":
             "tests/resources/content/subpackage.jar"})

    content.testendpoint_validator = MockTestEndpoint(("test_inner_package",
                                                       "test_package"))

    result = content.test_packed_packages(
                                    err,
                                    mock_package)
    print result
    assert result == 2
    content.testendpoint_validator.assert_expectation(
                                    "test_package",
                                    2)
    content.testendpoint_validator.assert_expectation(
                                    "test_package",
                                    0,
                                    "subpackage")
开发者ID:malyshkosergey,项目名称:amo-validator,代码行数:27,代码来源:test_content.py

示例13: test_css

def test_css():
    "Tests css files in the content validator."
    
    err = ErrorBundle(None, True)
    mock_package = MockXPIManager(
        {"foo.css":
             "tests/resources/content/junk.xpi"})
                        
    content.testendpoint_css = \
        MockTestEndpoint(("test_css_file", ))
    
    result = content.test_packed_packages(
                                    err,
                                    {"foo.css":
                                      {"extension": "css",
                                       "name_lower": "foo.css"}},
                                    mock_package)
    print result
    assert result == 1
    content.testendpoint_css.assert_expectation(
                                    "test_css_file",
                                    1)
    content.testendpoint_css.assert_expectation(
                                    "test_css_file",
                                    0,
                                    "subpackage")
开发者ID:nmaier,项目名称:amo-validator,代码行数:26,代码来源:test_content.py

示例14: test_langpack

def test_langpack():
    "Tests a language pack in the content validator."
    
    err = ErrorBundle(None, True)
    err.set_type(PACKAGE_LANGPACK)
    mock_package = MockXPIManager(
        {"foo.dtd":
             "tests/resources/content/junk.xpi"})
                        
    content.testendpoint_langpack = \
        MockTestEndpoint(("test_unsafe_html", ))
    
    result = content.test_packed_packages(
                                    err,
                                    {"foo.dtd":
                                      {"extension": "dtd",
                                       "name_lower": "foo.dtd"}},
                                    mock_package)
    print result
    assert result == 1
    content.testendpoint_langpack.assert_expectation(
                                    "test_unsafe_html",
                                    1)
    content.testendpoint_langpack.assert_expectation(
                                    "test_unsafe_html",
                                    0,
                                    "subpackage")
开发者ID:nmaier,项目名称:amo-validator,代码行数:27,代码来源:test_content.py

示例15: test_jar_subpackage

def test_jar_subpackage():
    "Tests JAR files that are subpackages."
    
    err = ErrorBundle(None, True)
    mock_package = MockXPIManager(
        {"chrome/subpackage.jar":
             "tests/resources/content/subpackage.jar",
         "nonsubpackage.jar":
             "tests/resources/content/subpackage.jar"})
                        
    content.testendpoint_validator = \
        MockTestEndpoint(("test_inner_package", ))
    
    result = content.test_packed_packages(
                                    err,
                                    {"chrome/subpackage.jar":
                                      {"extension": "jar",
                                       "name_lower": "subpackage.jar"},
                                     "nonsubpackage.jar":
                                      {"extension": "jar",
                                       "name_lower": "subpackage.jar"},
                                       },
                                    mock_package)
    print result
    assert result == 2
    content.testendpoint_validator.assert_expectation(
                                    "test_inner_package",
                                    2)
    content.testendpoint_validator.assert_expectation(
                                    "test_inner_package",
                                    1,
                                    "subpackage")
开发者ID:nmaier,项目名称:amo-validator,代码行数:32,代码来源:test_content.py


注:本文中的validator.testcases.content.test_packed_packages函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。