diff options
author | Michael Manfre | 2022-11-22 21:52:40 -0500 |
---|---|---|
committer | GitHub | 2022-11-22 19:52:40 -0700 |
commit | cdfff32f9af75730ca560833744433f1dc07067f (patch) | |
tree | d62719a4bd3269ec33f7bcde6c1a783fcef9792e /tests/activities/views | |
parent | db0edcd2ae7ad3d191974a47b8c0da8c3fc31e80 (diff) | |
download | takahe-cdfff32f9af75730ca560833744433f1dc07067f.tar.gz takahe-cdfff32f9af75730ca560833744433f1dc07067f.tar.bz2 takahe-cdfff32f9af75730ca560833744433f1dc07067f.zip |
Content warning name customisation
Allows the name of Content Warning to be customized (e.g. to "Content Summary").
Fixes #28.
Diffstat (limited to 'tests/activities/views')
-rw-r--r-- | tests/activities/views/test_posts.py | 24 | ||||
-rw-r--r-- | tests/activities/views/test_timelines.py | 18 |
2 files changed, 42 insertions, 0 deletions
diff --git a/tests/activities/views/test_posts.py b/tests/activities/views/test_posts.py new file mode 100644 index 0000000..b04c30f --- /dev/null +++ b/tests/activities/views/test_posts.py @@ -0,0 +1,24 @@ +import re + +import mock +import pytest + +from activities.views.posts import Compose + + +@pytest.mark.django_db +def test_content_warning_text(identity, user, rf, config_system): + request = rf.get("/compose/") + request.user = user + request.identity = identity + + config_system.content_warning_text = "Content Summary" + with mock.patch("core.models.Config.load_system", return_value=config_system): + view = Compose.as_view() + resp = view(request) + assert resp.status_code == 200 + content = str(resp.rendered_content) + assert 'placeholder="Content Summary"' in content + assert re.search( + r"<label.*>\s*Content Summary\s*</label>", content, flags=re.MULTILINE + ) diff --git a/tests/activities/views/test_timelines.py b/tests/activities/views/test_timelines.py new file mode 100644 index 0000000..6c8b355 --- /dev/null +++ b/tests/activities/views/test_timelines.py @@ -0,0 +1,18 @@ +import mock +import pytest + +from activities.views.timelines import Home + + +@pytest.mark.django_db +def test_content_warning_text(identity, user, rf, config_system): + request = rf.get("/") + request.user = user + request.identity = identity + + config_system.content_warning_text = "Content Summary" + with mock.patch("core.models.Config.load_system", return_value=config_system): + view = Home.as_view() + resp = view(request) + assert resp.status_code == 200 + assert 'placeholder="Content Summary"' in str(resp.rendered_content) |