From 0a1b114cc298f8562281672dc29163d415b17e18 Mon Sep 17 00:00:00 2001 From: Henry Fredrick Schreiner Date: Wed, 24 Jan 2018 11:10:48 +0100 Subject: [PATCH] Adding translate test --- tests/test_translate.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tests/test_translate.py diff --git a/tests/test_translate.py b/tests/test_translate.py new file mode 100644 index 000000000..cd71643fb --- /dev/null +++ b/tests/test_translate.py @@ -0,0 +1,28 @@ +# Setting French as system language +import os +os.environ['LC_ALL'] = 'fr_FR.utf-8' + +import pytest +import sys + +from plumbum import cli + +class Simple(cli.Application): + foo = cli.SwitchAttr("--foo") + + def main(self): + pass + +class TestFRCLI: + def test_nolang_switches(self): + _, rc = Simple.run(["foo", "-h"], exit = False) + assert rc == 0 + _, rc = Simple.run(["foo", "--version"], exit = False) + assert rc == 0 + + def test_help_lang(self, capsys): + _, rc = Simple.run(["foo", "-h"], exit = False) + assert rc == 0 + stdout, stderr = capsys.readouterr() + assert "Utilisation" in stdout + assert "Imprime ce message d'aide et sort" in stdout