Example #1
0
class TestModels(FormatTest, TestCase):

    def setUp(self):
        self.my_type = '[Exam - Models]'
        stderr.write(self.__str__())
        self.mock = DatabaseMock()

    def test_property_specific_exam(self):
        from exam.models import Exam
        from biopsy.models import Biopsy

        self.mock.create_exam_type()
        self.mock.create_exam_biopsy()
        exam = Exam.objects.earliest('id')

        exam.specific_exam | should | be_kind_of(Biopsy)

    def test_property_patient_information(self):
        from exam.models import Exam
        from patients.models import Paciente

        self.mock.create_patient()
        self.mock.create_exam_biopsy()
        exam = Exam.objects.get(id=1)

        exam.patient_information | should | be_kind_of(Paciente)
Example #2
0
class TestViews(FormatTest, TestCase):
    def setUp(self):
        self.my_type = '[Necropsy - Views]'
        stderr.write(self.__str__())
        self.db_mock = DatabaseMock()
        self.db_mock.create_user()
        self.db_mock.create_patient()
        self.db_mock.create_exam_type()
        self.db_mock.create_necropsy_status()
        self.db_mock.create_exam_necropsy()
        self.db_mock.create_necropsy(1)
        self.client = Client()
        self.client.login(username='******', password='******')


    def test_register_necropsy(self):
        response = self.client.post('/autopsia/', {
            'necropsy_id': '2',
            'examination_time': '12:00',
            'clinical_information': 'teste exame de necropsia',
            'main_disease': 'Doenca Principal',
            'consequential_final_disease': 'Consequencia da Doenca',
            'contributors_disease': 'Doencas Contribuintes',
            'consequential_disease': 'Consequencia da Doenca',
            'other_diseases': 'Outras Doencas',
            'note': 'Nota',
            'footer': 'Legenda'
        })

        necropsy_registered = Necropsy.objects.get(clinical_information='teste exame de necropsia')
        necropsy_registered.examination_time | should | equal_to(datetime.time(12, 0))
        necropsy_registered.clinical_information | should | equal_to('teste exame de necropsia')
        necropsy_registered.main_disease | should | equal_to('Doenca Principal')
        necropsy_registered.consequential_final_disease | should | equal_to('Consequencia da Doenca')
        necropsy_registered.contributors_disease | should | equal_to('Doencas Contribuintes')
        necropsy_registered.consequential_disease | should | equal_to('Consequencia da Doenca')
        necropsy_registered.other_diseases | should | equal_to('Outras Doencas')
        necropsy_registered.note | should | equal_to('Nota')
        necropsy_registered.footer | should | equal_to('Legenda')

        # If the method is executed sucessfully, the final instruction is to render
        # Status code 200 means sucessfully redered
        response.status_code | should | equal_to(302)
Example #3
0
class TestViews(FormatTest, TestCase):
    def setUp(self):
        self.my_type = '[Biopsy - Views]'
        stderr.write(self.__str__())
        self.db_mock = DatabaseMock()
        self.db_mock.create_user()
        self.db_mock.create_patient()
        self.db_mock.create_exam_type()
        self.db_mock.create_biopsy_status()
        self.db_mock.create_exam_biopsy()
        self.db_mock.create_biopsy(1)
        self.client = Client()
        self.client.login(username='******', password='******')


    def test_register_biopsy(self):
        response = self.client.post('/biopsia/', {
            'biopsy_id': '1',
            'examination_time': '12:00',
            'clinical_information': 'teste exame de biopsia',
            'macroscopic': 'Macroscopia',
            'microscopic': 'Microscopia',
            'conclusion': 'Conclusao',
            'note': 'Anotacao qualquer',
            'footer': 'Legenda qualquer'
        })

        biopsy_registered = Biopsy.objects.get(clinical_information="teste exame de biopsia")
        biopsy_registered.examination_time | should | equal_to(datetime.time(12, 0))
        biopsy_registered.clinical_information | should | equal_to('teste exame de biopsia')
        biopsy_registered.macroscopic | should | equal_to('Macroscopia')
        biopsy_registered.microscopic | should | equal_to('Microscopia')
        biopsy_registered.conclusion | should | equal_to('Conclusao')
        biopsy_registered.note | should | equal_to('Anotacao qualquer')
        biopsy_registered.footer | should | equal_to('Legenda qualquer')

        # If the method is executed sucessfully, the final instruction is to redirect
        # Status code 302 means sucessfully redirected
        response.status_code | should | equal_to(302)
Example #4
0
class TestViews(FormatTest, TestCase):

    def setUp(self):
        self.my_type = '[Exam - Views]'
        stderr.write(self.__str__())

        self.mock = DatabaseMock()
        self.mock.create_exam_type()
        self.mock.create_user()

        self.client = Client()
        self.client.login(username='******', password='******')

    def test_new_exam(self):
        self.mock.create_patient()
        response = self.client.post('/exame/novo/', {
            'patient_id': '1',
        })

        response.status_code | should | be(200)

    def test_register_exam(self):
        from exam.models import Exam
        before_save_exam = list(Exam.objects.all())

        self.mock.create_biopsy_status()
        response = self.client.post('/exame/registrar/', {
            'patient_id': '1',
            'receipt_date': '01/01/2000',
            'request_date': '01/01/2000',
            'speciment_collection_date': '01/01/2000',
            'requesting_physician': 'Requesting Physician',
            'received_speciment': 'Received Speciment',
            'csrfmiddlewaretoken': 'csrf_token',
            'responsible_physician': 'Responsible Pyshician',
            'exam_type': '1',
        })

        after_save_exam = list(Exam.objects.all())

        response.status_code | should | be(200)
        len(after_save_exam) | should | be_greater_than(len(before_save_exam))

    def test_register_new_biopsy(self):
        from biopsy.models import Biopsy
        before_create_biopsy = list(Biopsy.objects.all())

        self.mock.create_biopsy_status()
        response = self.client.post('/exame/registrar/', {
            'patient_id': '1',
            'receipt_date': '01/01/2000',
            'request_date': '01/01/2000',
            'speciment_collection_date': '01/01/2000',
            'requesting_physician': 'Requesting Physician',
            'received_speciment': 'Received Speciment',
            'csrfmiddlewaretoken': 'csrf_token',
            'responsible_physician': 'Responsible Pyshician',
            'exam_type': '1',
        })

        after_create_biopsy = list(Biopsy.objects.all())

        response.status_code | should | be(200)
        len(after_create_biopsy) | should | be_greater_than(
            len(before_create_biopsy))

    def test_register_new_necropsy(self):
        from necropsy.models import Necropsy
        before_create_necropsy = list(Necropsy.objects.all())

        self.mock.create_necropsy_status()
        response = self.client.post('/exame/registrar/', {
            'patient_id': '1',
            'receipt_date': '01/01/2000',
            'request_date': '01/01/2000',
            'speciment_collection_date': '01/01/2000',
            'requesting_physician': 'Requesting Physician',
            'received_speciment': 'Received Speciment',
            'csrfmiddlewaretoken': 'csrf_token',
            'responsible_physician': 'Responsible Pyshician',
            'exam_type': '2',
        })

        after_create_necropsy = list(Necropsy.objects.all())

        response.status_code | should | be(200)
        len(after_create_necropsy) | should | be_greater_than(
            len(before_create_necropsy))

    def test_register_new_immunohistochemical(self):
        from immunohistochemical.models import ImmunoHistochemical
        before_create_immunohistochemical = list(
            ImmunoHistochemical.objects.all())

        self.mock.create_immunohistochemical_status()
        response = self.client.post('/exame/registrar/', {
            'patient_id': '1',
            'receipt_date': '01/01/2000',
            'request_date': '01/01/2000',
            'speciment_collection_date': '01/01/2000',
            'requesting_physician': 'Requesting Physician',
            'received_speciment': 'Received Speciment',
            'csrfmiddlewaretoken': 'csrf_token',
            'responsible_physician': 'Responsible Pyshician',
            'exam_type': '3',
        })

        after_create_immunohistochemical = list(
            ImmunoHistochemical.objects.all())

        response.status_code | should | be(200)
        len(after_create_immunohistochemical) | should | be_greater_than(
            len(before_create_immunohistochemical))

    def test_register_new_cytology(self):
        from cytology.models import Cytology
        before_create_cytology = list(
            Cytology.objects.all())

        self.mock.create_cytology_status
        response = self.client.post('/exame/registrar/', {
            'patient_id': '1',
            'receipt_date': '01/01/2000',
            'request_date': '01/01/2000',
            'speciment_collection_date': '01/01/2000',
            'requesting_physician': 'Requesting Physician',
            'received_speciment': 'Received Speciment',
            'csrfmiddlewaretoken': 'csrf_token',
            'responsible_physician': 'Responsible Pyshician',
            'exam_type': '4',
        })

        after_create_cytology = list(
            Cytology.objects.all())

        response.status_code | should | be(200)
        len(after_create_cytology) | should | be_greater_than(
            len(before_create_cytology))