diff --git a/bookwyrm/templates/settings/federated_server.html b/bookwyrm/templates/settings/federated_server.html index 31e0ffb9..249d7106 100644 --- a/bookwyrm/templates/settings/federated_server.html +++ b/bookwyrm/templates/settings/federated_server.html @@ -84,12 +84,11 @@
{% trans "All users from this instance will be deactivated." %}
{% else %} - {% comment %} - {% endcomment %} {% endif %} diff --git a/bookwyrm/tests/views/test_federation.py b/bookwyrm/tests/views/test_federation.py index 38da37d3..fdafcad0 100644 --- a/bookwyrm/tests/views/test_federation.py +++ b/bookwyrm/tests/views/test_federation.py @@ -56,7 +56,7 @@ class FederationViews(TestCase): result.render() self.assertEqual(result.status_code, 200) - def test_server_page_post(self): + def test_server_page_block(self): """ block a server """ server = models.FederatedServer.objects.create(server_name="hi.there.com") self.remote_user.federated_server = server @@ -76,6 +76,27 @@ class FederationViews(TestCase): # and the user was deactivated self.assertFalse(self.remote_user.is_active) + def test_server_page_unblock(self): + """ unblock a server """ + server = models.FederatedServer.objects.create( + server_name="hi.there.com", status="blocked" + ) + self.remote_user.federated_server = server + self.remote_user.is_active = False + self.remote_user.save() + + request = self.factory.post("") + request.user = self.local_user + request.user.is_superuser = True + + views.federation.unblock_server(request, server.id) + server.refresh_from_db() + self.remote_user.refresh_from_db() + self.assertEqual(server.status, "federated") + # and the user was re-activated + self.assertTrue(self.remote_user.is_active) + + def test_add_view_get(self): """ there are so many views, this just makes sure it LOADS """ # create mode diff --git a/bookwyrm/urls.py b/bookwyrm/urls.py index 398caade..f2d43a13 100644 --- a/bookwyrm/urls.py +++ b/bookwyrm/urls.py @@ -68,6 +68,11 @@ urlpatterns = [ views.FederatedServer.as_view(), name="settings-federated-server", ), + re_path( + r"^settings/federation/(?P