예제 #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',
     ])
예제 #2
0
 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"]
     )
예제 #3
0
파일: test_models.py 프로젝트: tjguk/opal
 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'
     ])
예제 #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'
     ])
예제 #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'
     ])
예제 #6
0
파일: test_models.py 프로젝트: shalomz/opal
 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'
         ])
예제 #7
0
파일: test_models.py 프로젝트: shalomz/opal
 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'])
예제 #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',
     ])
예제 #9
0
파일: test_models.py 프로젝트: tjguk/opal
 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'
     ])
예제 #10
0
파일: test_models.py 프로젝트: shalomz/opal
 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',
     ])
예제 #11
0
파일: test_models.py 프로젝트: shalomz/opal
 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'
     ])
예제 #12
0
파일: test_models.py 프로젝트: shalomz/opal
 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'
         ])
예제 #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'),
     ])
예제 #14
0
파일: test_models.py 프로젝트: shalomz/opal
 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'
         ])
예제 #15
0
파일: test_models.py 프로젝트: shalomz/opal
 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'
     ])
예제 #16
0
파일: test_models.py 프로젝트: shalomz/opal
 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")
예제 #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'),
         ]
     )
예제 #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'
         ]
     )
예제 #19
0
파일: test_models.py 프로젝트: shalomz/opal
    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'])
예제 #20
0
파일: test_models.py 프로젝트: shalomz/opal
 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'])
예제 #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")
예제 #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")
예제 #23
0
파일: test_models.py 프로젝트: shalomz/opal
 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)
예제 #24
0
파일: test_models.py 프로젝트: shalomz/opal
 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)
예제 #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'])
예제 #26
0
 def test_display_template(self, select):
     Subrecord.get_display_template()
     select.assert_called_with(['records/subrecord.html'])
예제 #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'
     ])
예제 #28
0
파일: test_models.py 프로젝트: shalomz/opal
 def test_form_template(self, find):
     Subrecord.get_form_template()
     find.assert_called_with(['forms/subrecord_form.html'])
예제 #29
0
 def test_form_template(self, find):
     Subrecord.get_form_template()
     find.assert_called_with([os.path.join('forms', 'subrecord_form.html')])
예제 #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")
예제 #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'
     ])
예제 #32
0
 def test_display_template(self, find):
     Subrecord.get_display_template()
     find.assert_called_with([os.path.join('records', 'subrecord.html')])
예제 #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'),
     ])
예제 #34
0
 def test_detail_template(self, find):
     Subrecord.get_detail_template()
     find.assert_called_with([
         'records/subrecord_detail.html',
         'records/subrecord.html'
     ])
예제 #35
0
 def test_get_modal_template_does_not_exist(self):
     self.assertEqual(None, Subrecord.get_modal_template())
예제 #36
0
 def test_get_form_url(self):
     url = Subrecord.get_form_url()
     self.assertEqual(url, '/templates/forms/subrecord.html')
예제 #37
0
파일: test_models.py 프로젝트: shalomz/opal
 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'])
예제 #38
0
파일: test_models.py 프로젝트: shalomz/opal
 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'])
예제 #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")
예제 #40
0
 def test_form_template(self, find):
     Subrecord.get_form_template()
     find.assert_called_with(['forms/subrecord_form.html'])
예제 #41
0
 def test_form_template(self, select):
     Subrecord.get_form_template()
     select.assert_called_with(['modals/subrecord_modal.html'])
예제 #42
0
 def test_get_form_url(self):
     url = Subrecord.get_form_url()
     self.assertEqual(url, '/templates/forms/subrecord.html')
예제 #43
0
 def test_display_template(self, find):
     Subrecord.get_display_template()
     find.assert_called_with([os.path.join('records', 'subrecord.html')])
예제 #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'),
     ])
예제 #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'),
     ])
예제 #46
0
 def test_form_template(self, find):
     Subrecord.get_form_template()
     find.assert_called_with([os.path.join('forms', 'subrecord_form.html')])
예제 #47
0
 def test_get_modal_template_does_not_exist(self):
     self.assertEqual(None, Subrecord.get_modal_template())
예제 #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'),
     ])
예제 #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')])
예제 #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')])
예제 #51
0
 def test_display_template(self, find):
     Subrecord.get_display_template()
     find.assert_called_with(['records/subrecord.html'])