Translated using Weblate (Ukrainian)
[mailman-postorious.git] / src / postorius / tests / test_utils.py
blobb3e433dacd4771dc6577242dfd66ca4a373db047
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2017-2023 by the Free Software Foundation, Inc.
4 # This file is part of Postorius.
6 # Postorius is free software: you can redistribute it and/or modify it under
7 # the terms of the GNU General Public License as published by the Free
8 # Software Foundation, either version 3 of the License, or (at your option)
9 # any later version.
11 # Postorius is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 # more details.
16 # You should have received a copy of the GNU General Public License along with
17 # Postorius. If not, see <http://www.gnu.org/licenses/>.
19 from django.test import RequestFactory, TestCase
21 from postorius.utils import render_api_error
24 class TestUtils(TestCase):
25 def setUp(self):
26 self.factory = RequestFactory()
28 def test_render_api_error_works(self):
29 request = self.factory.get('/postorius/lists')
30 response = render_api_error(request)
31 self.assertTrue(
32 'Mailman REST API not available.' in str(response.content)
34 self.assertEqual(response.status_code, 503)