Beispiel #1
0
def test_update_difference_detect(temp):
    out = StringIO()
    commands.update('locale', '_build/locale', language=('ja',), out=out)
    output = out.getvalue()
    assert output.count('Create:') == 1
    assert output.count('Update:') == 0
    assert output.count('Not Changed:') == 0

    with open('_build/locale/README.pot', 'a') as f:
        f.write('\nmsgid "test1"\nmsgstr ""\n')

    out.truncate(0)
    commands.update('locale', '_build/locale', out=out)
    output = out.getvalue()
    assert output.count('Create:') == 0
    assert output.count('Update:') == 1
    assert output.count('Not Changed:') == 0

    with open('_build/locale/README.pot', 'r') as f:
        d = f.read()
        d = d.replace('test1', 'test2')
    with open('_build/locale/README.pot', 'w') as f:
        f.write(d)

    out.truncate(0)
    commands.update('locale', '_build/locale', out=out)
    output = out.getvalue()
    assert output.count('Create:') == 0
    assert output.count('Update:') == 1
    assert output.count('Not Changed:') == 0

    out.truncate(0)
    commands.update('locale', '_build/locale', out=out)
    output = out.getvalue()
    assert output.count('Create:') == 0
    assert output.count('Update:') == 0
    assert output.count('Not Changed:') == 1
Beispiel #2
0
def test_update_difference_detect(temp):
    out = StringIO()
    commands.update('locale', '_build/locale', language=('ja', ), out=out)
    output = out.getvalue()
    assert output.count('Create:') == 1
    assert output.count('Update:') == 0
    assert output.count('Not Changed:') == 0

    with open('_build/locale/README.pot', 'a') as f:
        f.write('\nmsgid "test1"\nmsgstr ""\n')

    out.truncate(0)
    commands.update('locale', '_build/locale', out=out)
    output = out.getvalue()
    assert output.count('Create:') == 0
    assert output.count('Update:') == 1
    assert output.count('Not Changed:') == 0

    with open('_build/locale/README.pot', 'r') as f:
        d = f.read()
        d = d.replace('test1', 'test2')
    with open('_build/locale/README.pot', 'w') as f:
        f.write(d)

    out.truncate(0)
    commands.update('locale', '_build/locale', out=out)
    output = out.getvalue()
    assert output.count('Create:') == 0
    assert output.count('Update:') == 1
    assert output.count('Not Changed:') == 0

    out.truncate(0)
    commands.update('locale', '_build/locale', out=out)
    output = out.getvalue()
    assert output.count('Create:') == 0
    assert output.count('Update:') == 0
    assert output.count('Not Changed:') == 1
Beispiel #3
0
def test_stat(temp):
    out = StringIO()
    commands.update('locale', '_build/locale', language=('ja', ), out=out)
    commands.stat('locale', out=out)
    output = out.getvalue()
    assert 'README.po : 0 translated, 0 fuzzy, 1 untranslated.' in output
Beispiel #4
0
def test_update_simple(temp):
    commands.update('locale', '_build/locale', language=('ja', ))
Beispiel #5
0
def test_update_no_language(temp):
    commands.update('locale', '_build/locale')
Beispiel #6
0
def test_update_pot_notfound(temp):
    commands.update('locale')
Beispiel #7
0
def test_stat(temp):
    out = StringIO()
    commands.update('locale', '_build/locale', language=('ja',), out=out)
    commands.stat('locale', out=out)
    output = out.getvalue()
    assert 'README.po : 0 translated, 0 fuzzy, 1 untranslated.' in output
Beispiel #8
0
def test_update_simple(temp):
    commands.update('locale', '_build/locale', language=('ja',))
Beispiel #9
0
def test_update_no_language(temp):
    commands.update('locale', '_build/locale')
Beispiel #10
0
def test_update_pot_notfound(temp):
    commands.update('locale')