def test_results_aggregator():
    'Tests that language pack aggregation results are read properly.'

    err = ErrorBundle()
    l10n._aggregate_results(err,
                            [{'type':'missing_files',
                              'filename':'foo.bar'}],
                            {'name': 'en-US',
                             'target': 'foo.bar',
                             'jarred': False})
    assert err.failed()

    err = ErrorBundle()
    l10n._aggregate_results(err,
                            [{'type':'missing_entities',
                              'filename':'foo.bar',
                              'missing_entities':['asdf','ghjk']}],
                            {'name': 'en-US',
                             'target': 'foo.bar',
                             'jarred': False})
    assert err.failed()

    err = ErrorBundle()
    l10n._aggregate_results(err,
                            [{'type':'unchanged_entity',
                              'entities':0,
                              'unchanged_entities':[('asdf', 1), ('ghjk', 1)],
                              'filename':'foo.bar'},
                              {'type':'total_entities',
                               'entities':100}],
                            {'name': 'en-US',
                             'target': 'foo.bar',
                             'jarred': False})
    assert not err.failed()

    err = ErrorBundle()
    l10n._aggregate_results(err,
                            [{'type':'unchanged_entity',
                              'entities':50,
                              'unchanged_entities':[('asdf', 1), ('ghjk', 1)],
                              'filename':'foo.bar'},
                             {'type':'file_entity_count',
                              'filename':'foo.bar',
                              'entities':100},
                             {'type':'total_entities',
                              'entities':100}],
                            {'name': 'en-US',
                             'target': 'foo.bar',
                             'path': '/locale/en-US/',
                             'jarred': True})
    assert not err.failed()
    assert err.notices
    print err.notices
    assert all('//' not in ''.join(m['file']) for m in err.warnings)
Пример #2
0
def test_results_aggregator():
    "Tests that language pack aggregation results are read properly."
    
    err = ErrorBundle(None, True)
    l10n._aggregate_results(err,
                            [{"type":"missing_files",
                              "filename":"foo.bar"}],
                            {"name":"en-US", "path":"foo.bar"})
    assert err.failed()
    
    err = ErrorBundle(None, True)
    l10n._aggregate_results(err,
                            [{"type":"missing_entities",
                              "filename":"foo.bar",
                              "missing_entities":["asdf","ghjk"]}],
                            {"name":"en-US", "path":"foo.bar"})
    assert err.failed()
    
    err = ErrorBundle(None, True)
    l10n._aggregate_results(err,
                            [{"type":"unchanged_entity",
                              "entities":0,
                              "unchanged_entities":[("asdf", 1), ("ghjk", 1)],
                              "filename":"foo.bar"},
                              {"type":"total_entities",
                               "entities":100}],
                            {"name":"en-US", "path":"foo.bar"})
    assert not err.failed()

    err = ErrorBundle(None, True)
    l10n._aggregate_results(err,
                            [{"type":"unchanged_entity",
                              "entities":50,
                              "unchanged_entities":[("asdf", 1), ("ghjk", 1)],
                              "filename":"foo.bar"},
                             {"type":"file_entity_count",
                              "filename":"foo.bar",
                              "entities":100},
                             {"type":"total_entities",
                              "entities":100}],
                            {"name":"en-US",
                             "path":"foo.bar",
                             "target":"/locale/en-US/"})
    assert err.failed()
def test_results_aggregator():
    'Tests that language pack aggregation results are read properly.'

    err = ErrorBundle()
    l10n._aggregate_results(err, [{
        'type': 'missing_files',
        'filename': 'foo.bar'
    }], {
        'name': 'en-US',
        'target': 'foo.bar',
        'jarred': False
    })
    assert err.failed()

    err = ErrorBundle()
    l10n._aggregate_results(err, [{
        'type': 'missing_entities',
        'filename': 'foo.bar',
        'missing_entities': ['asdf', 'ghjk']
    }], {
        'name': 'en-US',
        'target': 'foo.bar',
        'jarred': False
    })
    assert err.failed()

    err = ErrorBundle()
    l10n._aggregate_results(err,
                            [{
                                'type': 'unchanged_entity',
                                'entities': 0,
                                'unchanged_entities': [('asdf', 1),
                                                       ('ghjk', 1)],
                                'filename': 'foo.bar'
                            }, {
                                'type': 'total_entities',
                                'entities': 100
                            }], {
                                'name': 'en-US',
                                'target': 'foo.bar',
                                'jarred': False
                            })
    assert not err.failed()

    err = ErrorBundle()
    l10n._aggregate_results(
        err, [{
            'type': 'unchanged_entity',
            'entities': 50,
            'unchanged_entities': [('asdf', 1), ('ghjk', 1)],
            'filename': 'foo.bar'
        }, {
            'type': 'file_entity_count',
            'filename': 'foo.bar',
            'entities': 100
        }, {
            'type': 'total_entities',
            'entities': 100
        }], {
            'name': 'en-US',
            'target': 'foo.bar',
            'path': '/locale/en-US/',
            'jarred': True
        })
    assert not err.failed()
    assert err.notices
    print err.notices
    assert all('//' not in ''.join(m['file']) for m in err.warnings)
Пример #4
0
def test_results_aggregator():
    "Tests that language pack aggregation results are read properly."

    err = ErrorBundle()
    l10n._aggregate_results(err, [{
        "type": "missing_files",
        "filename": "foo.bar"
    }], {
        "name": "en-US",
        "target": "foo.bar",
        "jarred": False
    })
    assert err.failed()

    err = ErrorBundle()
    l10n._aggregate_results(err, [{
        "type": "missing_entities",
        "filename": "foo.bar",
        "missing_entities": ["asdf", "ghjk"]
    }], {
        "name": "en-US",
        "target": "foo.bar",
        "jarred": False
    })
    assert err.failed()

    err = ErrorBundle()
    l10n._aggregate_results(err,
                            [{
                                "type": "unchanged_entity",
                                "entities": 0,
                                "unchanged_entities": [("asdf", 1),
                                                       ("ghjk", 1)],
                                "filename": "foo.bar"
                            }, {
                                "type": "total_entities",
                                "entities": 100
                            }], {
                                "name": "en-US",
                                "target": "foo.bar",
                                "jarred": False
                            })
    assert not err.failed()

    err = ErrorBundle()
    l10n._aggregate_results(
        err, [{
            "type": "unchanged_entity",
            "entities": 50,
            "unchanged_entities": [("asdf", 1), ("ghjk", 1)],
            "filename": "foo.bar"
        }, {
            "type": "file_entity_count",
            "filename": "foo.bar",
            "entities": 100
        }, {
            "type": "total_entities",
            "entities": 100
        }], {
            "name": "en-US",
            "target": "foo.bar",
            "path": "/locale/en-US/",
            "jarred": True
        })
    assert not err.failed()
    assert err.notices
    print err.notices
    assert all("//" not in "".join(m["file"]) for m in err.warnings)