def test_save_sort_order_skips_non_qs_contents(self): request, view, contents, profile = self._get_request_view_and_content() other_user = UserFactory() other_content = ContentFactory(author=other_user.profile, pinned=True) Content.objects.filter(id=other_content.id).update(order=100) view._save_sort_order([other_content.id]) other_content.refresh_from_db() assert other_content.order == 100
def test_save_sort_order_skips_non_qs_contents(self): request, view, contents, profile = self._get_request_view_and_content() other_user = UserFactory() other_content = ContentFactory(author=other_user.profile, pinned=True) Content.objects.filter(id=other_content.id).update(order=100) view._save_sort_order([other_content.id]) other_content.refresh_from_db() assert other_content.order == 100
def test_save_sort_order_skips_non_qs_contents(self, admin_client, rf): request, view, contents, profile = self._get_request_view_and_content( rf) other_user = UserFactory() other_content = ContentFactory(author=other_user.profile, order=100, pinned=True) view._save_sort_order([other_content.id]) other_content.refresh_from_db() assert other_content.order == 100
def test_update_view_updates_content(self, admin_client, rf): profile = Profile.objects.get(user__username="******") content = ContentFactory(author=profile) response = admin_client.post(reverse("content:update", kwargs={"pk": content.id}), { "text": "foobar", "visibility": Visibility.SITE.value, }) assert response.status_code == 302 content.refresh_from_db() assert content.text == "foobar" assert content.visibility == Visibility.SITE