示例#1
0
def test_plugin_find_translations_missing_langs(fs_plugin, caplog):
    _edit_file(fs_plugin, "/gnu_style/po/fr.po")
    _edit_file(fs_plugin, "/gnu_style/po/sw.po")
    assert (len([x for x in fs_plugin.find_translations()]) == 18)
    log = caplog.records()[0]
    assert log.levelname == "WARNING"
    assert log.message == "Could not import files for languages: fr, sw"
示例#2
0
文件: status.py 项目: ta2-1/pootle_fs
def test_project_status_instance(fs_plugin):
    assert fs_plugin.is_cloned is False
    status = fs_plugin.status()

    # calling status will call pull
    assert fs_plugin.is_cloned is True
    assert isinstance(status, ProjectFSStatus)
    assert str(status) == (
        "<ProjectFSStatus(Tutorial): fs_untracked: 18>")
    assert status.has_changed is True
    for k in STATUS_TYPES:
        if k == "fs_untracked":
            continue
        assert status[k] == []
        assert k not in status

    assert not status.get_unchanged()

    # when we fetch the translations their status is set to fs_added
    fs_plugin.fetch_translations()
    status = fs_plugin.status()
    assert "fs_added" in status
    assert all([isinstance(x.store_fs, StoreFS) for x in status['fs_added']])

    # pulling the translations makes us up-to-date
    fs_plugin.pull_translations()
    status = fs_plugin.status()
    assert status.has_changed is False
    assert str(status) == "<ProjectFSStatus(Tutorial): Everything up-to-date>"

    unchanged = status.get_unchanged()
    assert StoreFS.objects.count() == len(unchanged)
    for status_fs in unchanged:
        assert isinstance(status_fs, StoreFS)

    # We can reload the status object with status.check_status()
    old_status = fs_plugin.status()
    _edit_file(fs_plugin, "/gnu_style/po/en.po")
    assert old_status.has_changed is False
    assert status.has_changed is False

    new_status = status.check_status()

    assert old_status.has_changed is False
    assert status.has_changed is True
    assert new_status.has_changed is True
示例#3
0
文件: status.py 项目: ta2-1/pootle_fs
import pytest

from pootle_fs_pytest.utils import (
    _create_conflict, _edit_file, _remove_file, _remove_store, _setup_store,
    _update_store)


PLUGIN_STATUS = OrderedDict()
PLUGIN_STATUS["conflict_untracked"] = (
    lambda plugin: _create_conflict(plugin),
    {"conflict_untracked":
     [(u"/en/tutorial/subdir3/subsubdir/example5.po",
       "/non_gnu_style/locales/en/subsubdir/example5.po")]})
PLUGIN_STATUS["fs_unmatched"] = (
    lambda plugin: _edit_file(plugin, "foo.po"), {})
PLUGIN_STATUS["fs_untracked"] = (
    lambda plugin: _edit_file(
        plugin, "/non_gnu_style/locales/en/subsubdir/example5.po"),
    {"fs_untracked":
     [(u"/en/tutorial/subdir3/subsubdir/example5.po",
       "/non_gnu_style/locales/en/subsubdir/example5.po")]})
PLUGIN_STATUS["pootle_untracked"] = (
    lambda plugin: _setup_store("/en/tutorial/subdir3/subsubdir/example5.po"),
    {"pootle_untracked":
     [(u"/en/tutorial/subdir3/subsubdir/example5.po",
       "/non_gnu_style/locales/en/subsubdir/example5.po")]})
PLUGIN_STATUS["fs_added"] = (
    lambda plugin: (
        _edit_file(
            plugin, "/non_gnu_style/locales/en/subsubdir/example5.po"),
示例#4
0
from collections import OrderedDict

import pytest

from pootle_fs_pytest.utils import (_create_conflict, _edit_file, _remove_file,
                                    _remove_store, _setup_store, _update_store)

PLUGIN_STATUS = OrderedDict()
PLUGIN_STATUS["conflict_untracked"] = (
    lambda plugin: _create_conflict(plugin), {
        "conflict_untracked":
        [(u"/en/tutorial/subdir3/subsubdir/example5.po",
          "/non_gnu_style/locales/en/subsubdir/example5.po")]
    })
PLUGIN_STATUS["fs_unmatched"] = (lambda plugin: _edit_file(plugin, "foo.po"),
                                 {})
PLUGIN_STATUS["fs_untracked"] = (lambda plugin: _edit_file(
    plugin, "/non_gnu_style/locales/en/subsubdir/example5.po"), {
        "fs_untracked": [(u"/en/tutorial/subdir3/subsubdir/example5.po",
                          "/non_gnu_style/locales/en/subsubdir/example5.po")]
    })
PLUGIN_STATUS["pootle_untracked"] = (
    lambda plugin: _setup_store("/en/tutorial/subdir3/subsubdir/example5.po"),
    {
        "pootle_untracked":
        [(u"/en/tutorial/subdir3/subsubdir/example5.po",
          "/non_gnu_style/locales/en/subsubdir/example5.po")]
    })
PLUGIN_STATUS["fs_added"] = (
    lambda plugin: