Exemplo n.º 1
0
def test_t_IncorrectForceLangParamProvided_ExceptionRaised():
    try:
        t(method="GetValue", code="4", force_lang="testing")
        assert False
    except ApiCodeTranslationError:
        assert True
    except Exception:
        assert False
Exemplo n.º 2
0
def test_t_IncorrectMethodParamProvided_ExceptionRaised():
    try:
        t(method="testing", code="4")
        assert False
    except ApiCodeTranslationError:
        assert True
    except Exception:
        assert False
Exemplo n.º 3
0
def test_t_CorrectOwnMapProvided_NoProblemsExpected():
    for method_key, method_value in API_CODES.items():
        testing_method = method_key
        for code in method_value.keys():
            try:
                # For settings.lang
                ret = t(method_key, code)
                assert isinstance(ret, str) or isinstance(ret, dict)
                # For forced lang
                for lang in available_languages:
                    ret = t(method_key, code, force_lang=lang)
                    assert isinstance(ret, str)
                    assert True
            except Exception as e:
                assert False
Exemplo n.º 4
0
def test_t_CorrectParamsProvided_NoExceptionRaised():
    try:
        t(method="GetValue", code="4")
        assert True
    except Exception:
        assert False