summaryrefslogtreecommitdiffstats
path: root/tests/users
diff options
context:
space:
mode:
authorGabriel Rodríguez Alberich2022-12-14 18:15:46 +0100
committerGitHub2022-12-14 10:15:46 -0700
commitd1ce056288c97eea18e17f1b950194678618cefc (patch)
treef090c5da442348d7bf35a374cb4efc167e03d311 /tests/users
parent0d8b7db2729d94338824c748901637c625c103b0 (diff)
downloadtakahe-d1ce056288c97eea18e17f1b950194678618cefc.tar.gz
takahe-d1ce056288c97eea18e17f1b950194678618cefc.tar.bz2
takahe-d1ce056288c97eea18e17f1b950194678618cefc.zip
Show follows and following counts on profile page
And let their visibility be configured
Diffstat (limited to 'tests/users')
-rw-r--r--tests/users/views/settings/test_privacy.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/users/views/settings/test_privacy.py b/tests/users/views/settings/test_privacy.py
new file mode 100644
index 0000000..b961124
--- /dev/null
+++ b/tests/users/views/settings/test_privacy.py
@@ -0,0 +1,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)