Merge pull request #495 from dod-ccpo/editable-strings
Put app strings into a YAML file
This commit is contained in:
24
tests/utils/test_localization.py
Normal file
24
tests/utils/test_localization.py
Normal file
@@ -0,0 +1,24 @@
|
||||
import pytest
|
||||
from atst.utils.localization import translate, LocalizationInvalidKeyError
|
||||
|
||||
|
||||
def test_looking_up_existing_key():
|
||||
assert translate("testing.example_string") == "Hello World"
|
||||
|
||||
|
||||
def test_nested_keys():
|
||||
assert translate("testing.nested.example") == "Hello nested example"
|
||||
|
||||
|
||||
def test_with_variables():
|
||||
assert (
|
||||
translate("testing.example_with_variables", {"name": "Alice"})
|
||||
== "Hello, Alice!"
|
||||
)
|
||||
|
||||
assert translate("testing.example_with_variables", {"name": "Bob"}) == "Hello, Bob!"
|
||||
|
||||
|
||||
def test_looking_up_non_existent_key():
|
||||
with pytest.raises(LocalizationInvalidKeyError):
|
||||
translate("testing.an.invalid_key")
|
Reference in New Issue
Block a user