Esempio n. 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
Esempio n. 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
Esempio n. 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
Esempio n. 4
0
def test_update_simple(temp):
    commands.update('locale', '_build/locale', language=('ja', ))
Esempio n. 5
0
def test_update_no_language(temp):
    commands.update('locale', '_build/locale')
Esempio n. 6
0
def test_update_pot_notfound(temp):
    commands.update('locale')
Esempio n. 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
Esempio n. 8
0
def test_update_simple(temp):
    commands.update('locale', '_build/locale', language=('ja',))
Esempio n. 9
0
def test_update_no_language(temp):
    commands.update('locale', '_build/locale')
Esempio n. 10
0
def test_update_pot_notfound(temp):
    commands.update('locale')