Пример #1
0
def test_action_response_on_success(fs_plugin):
    response = ActionResponse(fs_plugin)
    status = fs_plugin.status()

    for fs_status in status["fs_untracked"]:
        action = response.add("fetched_from_fs", fs_status, complete=False)

    for action in response.failed():
        action.complete = True

    assert len(list(response.completed())) == 18
    assert len(list(response.completed("fetched_from_fs"))) == 18
    assert (
        len(list(response.completed("fetched_from_fs", "added_from_pootle")))
        == 18)
    assert list(response.failed()) == []
    assert not response.has_failed
Пример #2
0
def test_action_response(fs_plugin):
    response = ActionResponse(fs_plugin)
    assert [x for x in response] == []
    assert response.action_types == FS_ACTION.keys()
    for action_type in response.action_types:
        assert response[action_type] == []

    assert list(response.completed()) == []
    for action_type in response.action_types:
        assert list(response.completed(action_type)) == []
    assert list(response.completed(*response.action_types)) == []

    assert list(response.failed()) == []
    for action_type in response.action_types:
        assert list(response.failed(action_type)) == []
    assert list(response.failed(*response.action_types)) == []
    assert not response.has_failed
Пример #3
0
def test_action_response_failure(fs_plugin):
    response = ActionResponse(fs_plugin)
    status = fs_plugin.status()

    for fs_status in status["fs_untracked"]:
        action = response.add("fetched_from_fs", fs_status, complete=False)
        assert action.original_status == fs_status
        assert action.failed is True
        assert action.complete is False

    assert len(list(response.failed())) == 18
    assert len(list(response.failed("fetched_from_fs"))) == 18
    assert (
        len(list(response.failed("fetched_from_fs", "added_from_pootle")))
        == 18)
    assert list(response.completed()) == []
    assert response.has_failed
Пример #4
0
def test_response_arg(fs_plugin_suite):
    plugin = fs_plugin_suite
    plugin.status()
    response = ActionResponse(plugin)
    new_response = plugin.merge_translations(response=response)
    assert response is new_response

    new_response = plugin.add_translations(response=response)
    assert response is new_response

    new_response = plugin.pull_translations(response=response)
    assert response is new_response

    new_response = plugin.push_translations(response=response)
    assert response is new_response

    new_response = plugin.rm_translations(response=response)
    assert response is new_response

    new_response = plugin.sync_translations(response=response)
    assert response is new_response