Skip to content

Commit

Permalink
pytest: Separate text tests
Browse files Browse the repository at this point in the history
  • Loading branch information
martinburchell committed Apr 13, 2021
1 parent 96e4c45 commit 48253c2
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 13 deletions.
13 changes: 0 additions & 13 deletions server/camcops_server/cc_modules/cc_text.py
Expand Up @@ -31,7 +31,6 @@
from enum import auto, Enum, unique
from typing import TYPE_CHECKING

from camcops_server.cc_modules.cc_unittest import DemoRequestTestCase
from pendulum import Date

if TYPE_CHECKING:
Expand Down Expand Up @@ -297,15 +296,3 @@ def server_string(req: "CamcopsRequest", w: SS) -> str:
return _("Yes")

raise ValueError("Bad value passed to server_string")


class TextUnitTest(DemoRequestTestCase):
"""
Unit tests.
"""
def test_server_string(self) -> None:
for k in SS.__dict__.keys():
if k.startswith("_"):
continue
w = SS[k]
assert isinstance(server_string(self.req, w), str)
44 changes: 44 additions & 0 deletions server/camcops_server/cc_modules/tests/cc_text_tests.py
@@ -0,0 +1,44 @@
#!/usr/bin/env python

"""
camcops_server/cc_modules/cc_text.py
===============================================================================
Copyright (C) 2012-2020 Rudolf Cardinal (rudolf@pobox.com).
This file is part of CamCOPS.
CamCOPS is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
CamCOPS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with CamCOPS. If not, see <http://www.gnu.org/licenses/>.
===============================================================================
**Text used by the server, and translated.**
"""

from camcops_server.cc_modules.cc_text import server_string, SS
from camcops_server.cc_modules.cc_unittest import DemoRequestTestCase


class TextTestCase(DemoRequestTestCase):
"""
Unit tests.
"""
def test_server_string(self) -> None:
for k in SS.__dict__.keys():
if k.startswith("_"):
continue
w = SS[k]
assert isinstance(server_string(self.req, w), str)

0 comments on commit 48253c2

Please sign in to comment.