summaryrefslogtreecommitdiffstats
path: root/tests/activities/views/test_posts.py
blob: b04c30f394e85cb753ca3afafa3d7124d35ada17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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
        )