summaryrefslogtreecommitdiffstats
path: root/tests/users/views/settings/test_privacy.py
blob: b96112445fefcad9eb509eb1e325c32d5f06211b (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
25
26
import pytest
from pytest_django.asserts import assertContains, assertNotContains

from core.models.config import Config
from users.models import Follow


@pytest.mark.django_db
def test_stats(client, identity, other_identity):
    """
    Tests that follow stats are visible
    """
    Follow.objects.create(source=other_identity, target=identity)
    Config.set_identity(identity, "visible_follows", True)
    response = client.get(identity.urls.view)
    assertContains(response, "<strong>1</strong> followers", status_code=200)


@pytest.mark.django_db
def test_visible_follows_disabled(client, identity):
    """
    Tests that disabling visible follows hides it from profile
    """
    Config.set_identity(identity, "visible_follows", False)
    response = client.get(identity.urls.view)
    assertNotContains(response, '<div class="stats">', status_code=200)