Ejemplo n.º 1
0
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)
Ejemplo n.º 2
0
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)
    result = 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)
Ejemplo n.º 3
0
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)
    result = 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)
Ejemplo n.º 4
0
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)
Ejemplo n.º 5
0
def test_json():
    """Test the JSON output capability of the error bundler."""

    # Use the StringIO as an output buffer.
    bundle = ErrorBundle()
    bundle.detected_type = 4
    bundle.set_tier(4)
    bundle.set_tier(3)

    bundle.error((), "error", "description")
    bundle.warning((), "warning", "description")
    bundle.notice((), "notice", "description")

    results = json.loads(bundle.render_json())

    print results

    assert len(results["messages"]) == 3
    assert results["detected_type"] == "langpack"
    assert not results["success"]
    assert results["ending_tier"] == 4
Ejemplo n.º 6
0
def test_json():
    """Test the JSON output capability of the error bundler."""

    # Use the StringIO as an output buffer.
    bundle = ErrorBundle()  # No color since no output
    bundle.detected_type = 4
    bundle.set_tier(4)
    bundle.set_tier(3)

    bundle.error((), 'error', 'description')
    bundle.warning((), 'warning', 'description')
    bundle.notice((), 'notice', 'description')

    results = json.loads(bundle.render_json())

    print results

    assert len(results['messages']) == 3
    assert results['detected_type'] == 'langpack'
    assert not results['success']
    assert results['ending_tier'] == 4
def test_json():
    """Test the JSON output capability of the error bundler."""

    # Use the StringIO as an output buffer.
    bundle = ErrorBundle()  # No color since no output
    bundle.detected_type = 4
    bundle.set_tier(4)
    bundle.set_tier(3)

    bundle.error((), 'error', 'description')
    bundle.warning((), 'warning', 'description')
    bundle.notice((), 'notice', 'description')

    results = json.loads(bundle.render_json())

    print results

    assert len(results['messages']) == 3
    assert results['detected_type'] == 'langpack'
    assert not results['success']
    assert results['ending_tier'] == 4
Ejemplo n.º 8
0
def test_json():
    """Test the JSON output capability of the error bundler."""

    # Use the StringIO as an output buffer.
    bundle = ErrorBundle()  # No color since no output
    bundle.detected_type = 4
    bundle.set_tier(4)
    bundle.set_tier(3)

    bundle.error((), "error", "description")
    bundle.warning((), "warning", "description")
    bundle.notice((), "notice", "description")

    results = json.loads(bundle.render_json())

    print results

    assert len(results["messages"]) == 3
    assert results["detected_type"] == 'langpack'
    assert not results["success"]
    assert results["ending_tier"] == 4