Beispiel #1
0
 def test_modal_template_subteam(self, select):
     Subrecord.get_form_template(team='test', subteam='really')
     select.assert_called_with([
         'modals/test/really/subrecord_modal.html',
         'modals/test/subrecord_modal.html',
         'modals/subrecord_modal.html',
     ])
 def test_modal_template(self, get_template, get_form_template, find):
     get_form_template.return_value = "some_template"
     get_template.return_value = None
     Subrecord.get_modal_template()
     find.assert_called_with(
         ["base_templates/form_modal_base.html"]
     )
Beispiel #3
0
 def test_detail_template_episode_type(self, find):
     Subrecord.get_detail_template(episode_type='Inpatient')
     find.assert_called_with([
         'records/inpatient/subrecord_detail.html',
         'records/inpatient/subrecord.html',
         'records/subrecord_detail.html', 'records/subrecord.html'
     ])
Beispiel #4
0
 def test_display_template_subteam(self, select):
     Subrecord.get_display_template(team='test', subteam='really')
     select.assert_called_with([
         'records/test/really/subrecord.html',
         'records/test/subrecord.html',
         'records/subrecord.html'
     ])
Beispiel #5
0
 def test_modal_template_episode_type(self, find):
     Subrecord.get_modal_template(episode_type='Inpatient')
     find.assert_called_with([
         'modals/inpatient/subrecord_modal.html',
         'modals/subrecord_modal.html',
         'base_templates/form_modal_base.html'
     ])
Beispiel #6
0
 def test_form_template_episode_type(self, find):
     with warnings.catch_warnings(record=True):
         Subrecord.get_form_template(episode_type='Inpatient')
         find.assert_called_with([
             'forms/inpatient/subrecord_form.html',
             'forms/subrecord_form.html'
         ])
Beispiel #7
0
 def test_detail_template_list(self, find):
     with warnings.catch_warnings(record=True):
         patient_list = MagicMock()
         patient_list.get_prefixes.return_value = []
         Subrecord.get_detail_template(patient_list=patient_list)
         find.assert_called_with(
             ['records/subrecord_detail.html', 'records/subrecord.html'])
Beispiel #8
0
 def test_modal_template_subteam(self, select):
     Subrecord.get_form_template(team='test', subteam='really')
     select.assert_called_with([
         'modals/test/really/subrecord_modal.html',
         'modals/test/subrecord_modal.html',
         'modals/subrecord_modal.html',
     ])
Beispiel #9
0
 def test_modal_template_list(self, find):
     patient_list = MagicMock()
     patient_list.get_template_prefixes = MagicMock(return_value=["test"])
     Subrecord.get_modal_template(patient_list=patient_list)
     find.assert_called_with([
         'modals/test/subrecord_modal.html', 'modals/subrecord_modal.html',
         'modal_base.html'
     ])
Beispiel #10
0
 def test_display_template_list(self, find):
     patient_list = MagicMock()
     patient_list.get_template_prefixes = MagicMock(return_value=["test"])
     Subrecord.get_display_template(patient_list=patient_list)
     find.assert_called_with([
         'records/test/subrecord.html',
         'records/subrecord.html',
     ])
Beispiel #11
0
 def test_detail_template_prefixes(self, find):
     find.return_value = None
     Subrecord.get_detail_template(prefixes=['onions'])
     self.assertEqual(find.call_args_list[0][0][0], [
         'records/onions/subrecord_detail.html',
         'records/onions/subrecord.html', 'records/subrecord_detail.html',
         'records/subrecord.html'
     ])
Beispiel #12
0
 def test_detail_template_episode_type(self, find):
     with warnings.catch_warnings(record=True):
         find.return_value = None
         Subrecord.get_detail_template(episode_type='Inpatient')
         self.assertEqual(find.call_args_list[0][0][0], [
             'records/inpatient/subrecord_detail.html',
             'records/inpatient/subrecord.html',
             'records/subrecord_detail.html', 'records/subrecord.html'
         ])
Beispiel #13
0
 def test_detail_template_prefixes(self, find):
     find.return_value = None
     Subrecord.get_detail_template(prefixes=['onions'])
     self.assertEqual(find.call_args_list[0][0][0], [
         os.path.join('records', 'onions', 'subrecord_detail.html'),
         os.path.join('records', 'onions', 'subrecord.html'),
         os.path.join('records', 'subrecord_detail.html'),
         os.path.join('records', 'subrecord.html'),
     ])
Beispiel #14
0
 def test_form_template_list(self, find):
     with warnings.catch_warnings(record=True):
         patient_list = MagicMock()
         patient_list.get_template_prefixes = MagicMock(
             return_value=["test"])
         Subrecord.get_form_template(patient_list=patient_list)
         find.assert_called_with([
             'forms/test/subrecord_form.html', 'forms/subrecord_form.html'
         ])
Beispiel #15
0
 def test_form_template_list_and_prefix(self, find):
     patient_list = MagicMock()
     patient_list.get_template_prefixes = MagicMock(return_value=["test"])
     Subrecord.get_form_template(prefixes=["onions"],
                                 patient_list=patient_list)
     find.assert_called_with([
         'forms/onions/subrecord_form.html',
         'forms/test/subrecord_form.html', 'forms/subrecord_form.html'
     ])
Beispiel #16
0
 def test_build_template_selection_value_error(self):
     with self.assertRaises(ValueError) as v:
         with warnings.catch_warnings(record=True):
             episode_type = "Trees"
             patient_list = "Shrubbery"
             Subrecord._build_template_selection(suffix=".html",
                                                 prefix="some_prefix",
                                                 episode_type=episode_type,
                                                 patient_list=patient_list)
         self.assertEqual(
             str(v), "you can not get both a patient list and episode type")
Beispiel #17
0
 def test_detail_template_prefixes(self, find):
     find.return_value = None
     Subrecord.get_detail_template(prefixes=['onions'])
     self.assertEqual(
         find.call_args_list[0][0][0],
         [
             os.path.join('records', 'onions', 'subrecord_detail.html'),
             os.path.join('records', 'onions', 'subrecord.html'),
             os.path.join('records', 'subrecord_detail.html'),
             os.path.join('records', 'subrecord.html'),
         ]
     )
Beispiel #18
0
 def test_detail_template_prefixes(self, find):
     find.return_value = None
     Subrecord.get_detail_template(prefixes=['onions'])
     self.assertEqual(
         find.call_args_list[0][0][0],
         [
             'records/onions/subrecord_detail.html',
             'records/onions/subrecord.html',
             'records/subrecord_detail.html',
             'records/subrecord.html'
         ]
     )
Beispiel #19
0
    def test_modal_template_episode_type(self, find):
        with warnings.catch_warnings(record=True):
            find.return_value = None
            with patch.object(Subrecord, "get_form_template") as get_form:
                get_form.return_value = True
                Subrecord.get_modal_template(episode_type='Inpatient')

                self.assertEqual(find.call_args_list[0][0][0], [
                    'modals/inpatient/subrecord_modal.html',
                    'modals/subrecord_modal.html',
                ])
                self.assertEqual(find.call_args_list[1][0][0],
                                 ['base_templates/form_modal_base.html'])
Beispiel #20
0
 def test_modal_template_list(self, find):
     with warnings.catch_warnings(record=True):
         find.return_value = None
         patient_list = MagicMock()
         patient_list.get_template_prefixes = MagicMock(
             return_value=["test"])
         with patch.object(Subrecord, "get_form_template") as get_form:
             get_form.return_value = True
             Subrecord.get_modal_template(patient_list=patient_list)
             self.assertEqual(find.call_args_list[0][0][0], [
                 'modals/test/subrecord_modal.html',
                 'modals/subrecord_modal.html',
             ])
             self.assertEqual(find.call_args_list[1][0][0],
                              ['base_templates/form_modal_base.html'])
Beispiel #21
0
    def test_get_template_with_prefixes(self, find):
        find.return_value = "found"
        result = Subrecord._get_template("a_{}_b", prefixes=["onions"])

        find.assert_called_once_with(
            [os.path.join("a_onions", "subrecord_b"), "a_subrecord_b"])
        self.assertEqual(result, "found")
Beispiel #22
0
    def test_get_template_with_prefixes(self, find):
        find.return_value = "found"
        result = Subrecord._get_template("a_{}_b", prefixes=["onions"])

        find.assert_called_once_with([
            os.path.join("a_onions", "subrecord_b"),
            "a_subrecord_b"
        ])
        self.assertEqual(result, "found")
Beispiel #23
0
 def test_build_template_selection_episode_type(self, find):
     with warnings.catch_warnings(record=True):
         episode_type = "Trees"
         result = Subrecord._build_template_selection(
             suffix=".html",
             prefix="some_prefix",
             episode_type=episode_type)
         self.assertEqual([
             'some_prefix/trees/subrecord.html',
             'some_prefix/subrecord.html'
         ], result)
Beispiel #24
0
 def test_build_template_selection_patient_list(self):
     with warnings.catch_warnings(record=True):
         patient_list = MagicMock()
         patient_list.get_template_prefixes.return_value = ["trees"]
         result = Subrecord._build_template_selection(
             suffix=".html",
             prefix="some_prefix",
             patient_list=patient_list)
         self.assertEqual([
             'some_prefix/trees/subrecord.html',
             'some_prefix/subrecord.html'
         ], result)
Beispiel #25
0
 def test_modal_template_no_form_template(self, modal, find):
     modal.return_value = None
     Subrecord.get_modal_template()
     find.assert_called_with(['modals/subrecord_modal.html'])
Beispiel #26
0
 def test_display_template(self, select):
     Subrecord.get_display_template()
     select.assert_called_with(['records/subrecord.html'])
Beispiel #27
0
 def test_detail_template_team(self, select):
     Subrecord.get_detail_template(team='test')
     select.assert_called_with([
         'records/subrecord_detail.html',
         'records/subrecord.html'
     ])
Beispiel #28
0
 def test_form_template(self, find):
     Subrecord.get_form_template()
     find.assert_called_with(['forms/subrecord_form.html'])
Beispiel #29
0
 def test_form_template(self, find):
     Subrecord.get_form_template()
     find.assert_called_with([os.path.join('forms', 'subrecord_form.html')])
Beispiel #30
0
 def test_get_template(self, find):
     find.return_value = "found"
     result = Subrecord._get_template("a_{}_b")
     find.assert_called_once_with(["a_subrecord_b"])
     self.assertEqual(result, "found")
Beispiel #31
0
 def test_form_template_prefixes(self, find):
     Subrecord.get_form_template(prefixes=['onions'])
     find.assert_called_with([
         'forms/onions/subrecord_form.html',
         'forms/subrecord_form.html'
     ])
Beispiel #32
0
 def test_display_template(self, find):
     Subrecord.get_display_template()
     find.assert_called_with([os.path.join('records', 'subrecord.html')])
Beispiel #33
0
 def test_detail_template(self, find):
     Subrecord.get_detail_template()
     find.assert_called_with([
         os.path.join('records', 'subrecord_detail.html'),
         os.path.join('records', 'subrecord.html'),
     ])
Beispiel #34
0
 def test_detail_template(self, find):
     Subrecord.get_detail_template()
     find.assert_called_with([
         'records/subrecord_detail.html',
         'records/subrecord.html'
     ])
Beispiel #35
0
 def test_get_modal_template_does_not_exist(self):
     self.assertEqual(None, Subrecord.get_modal_template())
Beispiel #36
0
 def test_get_form_url(self):
     url = Subrecord.get_form_url()
     self.assertEqual(url, '/templates/forms/subrecord.html')
Beispiel #37
0
 def test_form_template_prefixes(self, find):
     Subrecord.get_form_template(prefixes=['onions'])
     find.assert_called_with(
         ['forms/onions/subrecord_form.html', 'forms/subrecord_form.html'])
Beispiel #38
0
 def test_modal_template_no_form_template(self, modal, find):
     modal.return_value = None
     Subrecord.get_modal_template()
     find.assert_called_with(['modals/subrecord_modal.html'])
Beispiel #39
0
 def test_get_template(self, find):
     find.return_value = "found"
     result = Subrecord._get_template("a_{}_b")
     find.assert_called_once_with(["a_subrecord_b"])
     self.assertEqual(result, "found")
Beispiel #40
0
 def test_form_template(self, find):
     Subrecord.get_form_template()
     find.assert_called_with(['forms/subrecord_form.html'])
Beispiel #41
0
 def test_form_template(self, select):
     Subrecord.get_form_template()
     select.assert_called_with(['modals/subrecord_modal.html'])
Beispiel #42
0
 def test_get_form_url(self):
     url = Subrecord.get_form_url()
     self.assertEqual(url, '/templates/forms/subrecord.html')
Beispiel #43
0
 def test_display_template(self, find):
     Subrecord.get_display_template()
     find.assert_called_with([os.path.join('records', 'subrecord.html')])
Beispiel #44
0
 def test_detail_template(self, find):
     Subrecord.get_detail_template()
     find.assert_called_with([
         os.path.join('records', 'subrecord_detail.html'),
         os.path.join('records', 'subrecord.html'),
     ])
Beispiel #45
0
 def test_form_template_prefixes(self, find):
     Subrecord.get_form_template(prefixes=['onions'])
     find.assert_called_with([
         os.path.join('forms', 'onions', 'subrecord_form.html'),
         os.path.join('forms', 'subrecord_form.html'),
     ])
Beispiel #46
0
 def test_form_template(self, find):
     Subrecord.get_form_template()
     find.assert_called_with([os.path.join('forms', 'subrecord_form.html')])
Beispiel #47
0
 def test_get_modal_template_does_not_exist(self):
     self.assertEqual(None, Subrecord.get_modal_template())
Beispiel #48
0
 def test_form_template_prefixes(self, find):
     Subrecord.get_form_template(prefixes=['onions'])
     find.assert_called_with([
         os.path.join('forms', 'onions', 'subrecord_form.html'),
         os.path.join('forms', 'subrecord_form.html'),
     ])
Beispiel #49
0
 def test_modal_template_no_form_template(self, modal, find):
     modal.return_value = None
     Subrecord.get_modal_template()
     find.assert_called_with([os.path.join('modals', 'subrecord_modal.html')])
Beispiel #50
0
 def test_modal_template_no_form_template(self, modal, find):
     modal.return_value = None
     Subrecord.get_modal_template()
     find.assert_called_with(
         [os.path.join('modals', 'subrecord_modal.html')])
Beispiel #51
0
 def test_display_template(self, find):
     Subrecord.get_display_template()
     find.assert_called_with(['records/subrecord.html'])