1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-15 00:03:28 +01:00
pywb/tests/test_locales.py
Ilya Kreymer 2ccd8eb2c3
tests run improvements: update from python setup.py test -> tox (#754)
* tests cleanup:
- move test requirements to test_requirements.txt to share between setup.py and tox.ini
- README: update to recommend using 'tox --current-env' for running tests locally
- replaces #741

* test tweaks:
- don't require i18n to import locmanager, instead set flag on load (to avoid breaking tox / pytest)
- don't add werkzeug to test requirements
2022-08-31 16:04:55 -07:00

35 lines
1.0 KiB
Python

from .base_config_test import BaseConfigTest
import pytest
# ============================================================================
class TestLocales(BaseConfigTest):
@classmethod
def setup_class(cls):
super(TestLocales, cls).setup_class('config_test_loc.yaml')
pytest.importorskip('babel')
pytest.importorskip('translate_toolkit')
def test_locale_en_home(self):
res = self.testapp.get('/en/')
assert 'Pywb Wayback Machine' in res.text, res.text
def test_locale_l337_home(self):
res = self.testapp.get('/l337/')
print(res.text)
assert r'Py\/\/b W4yb4ck /\/\4ch1n3' in res.text
def test_locale_en_replay_banner(self):
res = self.testapp.get('/en/pywb/mp_/https://example.com/')
assert '"en"' in res.text
assert '"Language:"' in res.text
def test_locale_l337_replay_banner(self):
res = self.testapp.get('/l337/pywb/mp_/https://example.com/')
assert '"l337"' in res.text
assert '"L4n9u4g3:"' in res.text