Esempio n. 1
0
def register_exam(request):
    exam = get_exam_form(request)
    exam.save()

    specific_exam = create_specific_exam(
        exam.exam_type.name_class)
    specific_exam.exam = exam
    specific_exam.save()

    # specific_exam.examination_time = specific_exam.examination_time.strftime('%H:%M')
    template_exam = 'update_' + exam.exam_type.name_class.lower() + '.html'

    return render_to_response(
        template_exam,
        {'exam': exam,
         'patient': exam.patient_information,
         'specific_exam': specific_exam},
        context_instance=RequestContext(request)
    )
    def test_create_immunohistochemical_exam(self):
        from immunohistochemical.models import ImmunoHistochemical

        immunohistochemical_exam = create_specific_exam('ImmunoHistochemical')
        immunohistochemical_exam | should | be_kind_of(ImmunoHistochemical)
    def test_create_cytology_exam(self):
        from cytology.models import Cytology

        cytology_exam = create_specific_exam('Cytology')
        cytology_exam | should | be_kind_of(Cytology)
    def test_create_specific_exam_invalid_model(self):
        from exam.exceptions import ModelDoesNotExist

        ModelDoesNotExist | should | be_thrown_by(
            lambda: create_specific_exam('InvalidModel'))
    def test_create_specific_exam_invalid_param(self):
        from exam.exceptions import InvalidParameter

        InvalidParameter | should | be_thrown_by(
            lambda: create_specific_exam(''))
    def test_create_necropsy_exam(self):
        from necropsy.models import Necropsy

        necropsy_exam = create_specific_exam('Necropsy')
        necropsy_exam | should | be_kind_of(Necropsy)
    def test_create_biopsy_exam(self):
        from biopsy.models import Biopsy

        biopsy_exam = create_specific_exam('Biopsy')
        biopsy_exam | should | be_kind_of(Biopsy)