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