def test_order_respected_by_list(self): expected = [ TaggingTestNotSubTag, TaggingTestPatientList, TaggingTestSameTagPatientList, InvisibleList, DisplayList, IconicList ] self.assertEqual(expected, list(PatientList.list()))
def test_order_respected_by_list(self): expected = [ TaggingTestNotSubTag, TaggingTestPatientList, TaggingTestSameTagPatientList, InvisibleList, ] self.assertEqual(expected, list(PatientList.list()))
def test_get_all_patient_lists(self): # this should not be taken as a reason not to do more indepth unit tests! # its just a nice sanity check patient_lists = PatientList.list() for pl in patient_lists: slug = pl.get_slug() url = reverse("patient_list_template_view", kwargs={"slug": slug}) self.assertStatusCode( url, 200, msg="Failed to load the template for {}".format(slug))
def test_get_all_patient_lists(self): # this should not be taken as a reason not to do more indepth unit tests! # its just a nice sanity check patient_lists = PatientList.list() for pl in patient_lists: slug = pl.get_slug() url = reverse( "patient_list_template_view", kwargs={"slug": slug} ) self.assertStatusCode( url, 200, msg="Failed to load the template for {}".format(slug) )
def test_get_all_patient_api(self): # this should not be taken as a reason not to do more indepth unit tests! # its just a nice sanity check patient_lists = PatientList.list() request = self.factory.get("/") request.user = self.user for pl in patient_lists: slug = pl.get_slug() url = drf_reverse( "patientlist-detail", kwargs={"pk": slug}, request=request ) self.assertStatusCode( url, 200, msg="Failed to load the template for {}".format(slug) )
def test_mine(self): ''' given to episodes, calling mine should only return the one tagged with the user ''' self.episode_1.set_tag_names(["mine"], self.user) self.assertIn(Mine, PatientList.list()) mock_request = MagicMock(name='Mock request') mock_request.user = self.user patient_list = PatientList.get("mine")() self.assertEqual( [self.episode_1], [i for i in patient_list.get_queryset()] ) serialized = patient_list.to_dict(self.user) self.assertEqual(len(serialized), 1) self.assertEqual(serialized[0]["id"], 1)
def test_known_abstract_subclasses_not_in_list(self): lists = list(PatientList.list()) self.assertNotIn(TaggedPatientList, lists)