Coverage for cc_modules/tests/cc_tracker_tests.py : 30%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1#!/usr/bin/env python
3"""
4camcops_server/cc_modules/tests/cc_tracker_tests.py
6===============================================================================
8 Copyright (C) 2012-2020 Rudolf Cardinal (rudolf@pobox.com).
10 This file is part of CamCOPS.
12 CamCOPS is free software: you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation, either version 3 of the License, or
15 (at your option) any later version.
17 CamCOPS is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with CamCOPS. If not, see <https://www.gnu.org/licenses/>.
25===============================================================================
27"""
29from camcops_server.cc_modules.cc_simpleobjects import IdNumReference
30from camcops_server.cc_modules.cc_taskcollection import TaskFilter
31from camcops_server.cc_modules.cc_tracker import ClinicalTextView, Tracker
32from camcops_server.cc_modules.cc_unittest import DemoDatabaseTestCase
35# =============================================================================
36# Unit tests
37# =============================================================================
39class TrackerCtvTests(DemoDatabaseTestCase):
40 """
41 Unit tests.
42 """
43 def setUp(self) -> None:
44 super().setUp()
46 self.taskfilter = TaskFilter()
48 idnum_ref = IdNumReference(which_idnum=0, idnum_value=0)
50 self.taskfilter.idnum_criteria = [idnum_ref]
51 self.taskfilter.tasks_with_patient_only = True
53 def test_tracker(self) -> None:
54 self.announce("test_tracker")
55 req = self.req
56 t = Tracker(req, self.taskfilter)
58 self.assertIsInstance(t.get_html(), str)
59 self.assertIsInstance(t.get_pdf(), bytes)
60 self.assertIsInstance(t.get_pdf_html(), str)
61 self.assertIsInstance(t.get_xml(), str)
62 self.assertIsInstance(t.suggested_pdf_filename(), str)
64 def test_ctv(self) -> None:
65 self.announce("test_ctv")
66 req = self.req
67 c = ClinicalTextView(req, self.taskfilter)
69 self.assertIsInstance(c.get_html(), str)
70 self.assertIsInstance(c.get_pdf(), bytes)
71 self.assertIsInstance(c.get_pdf_html(), str)
72 self.assertIsInstance(c.get_xml(), str)
73 self.assertIsInstance(c.suggested_pdf_filename(), str)