Пример #1
0
    def test_search_patient(self):
        #Search for 1 Patient.
        patients_result = search_patient('Test Patient', '', '', '')
        patients_result["empty_results"] | should | be(False)    
        patients_result["empty_fields"] | should | be(False)
        patients_result["patients"].count() | should | be(1)
        patients_result["patients"][0].nome | should | equal_to('Test Patient')        

        #Search for more than 1 Patient.
        patient = Paciente()
        patient.codigo = 2
        patient.nome = 'Test Patient2'
        patient.cpf = '11111111111'
        patient.nome_mae = 'Patient Mother'
        patient.nome_pai = 'Patient Father'
        patient.dt_nascimento = timezone.now()
        patient.nac_codigo = 1
        patient.cor = 'Test Color'
        patient.sexo = 'Male'
        patient.naturalidade = 'Test'
        patient.prontuario = 111111111
        patient.dt_obito = timezone.now()
        patient.rg = '111'
        patient.observacao = ''
        patient.prnt_ativo = 'Active'
        patient.sexo_biologico = 'Male'
        patient.nro_cartao_saude = 1111111
        patient.save(using='hub')
        patients_result = search_patient('Test','','','')
        patients_result["empty_results"] | should | be(False)    
        patients_result["empty_fields"] | should | be(False)
        patients_result["patients"].count() | should | be(2)
        patients_result["patients"][0].nome | should | equal_to('Test Patient')
        patients_result["patients"][1].nome | should | equal_to('Test Patient2')          

        #Search for 0 Patient.
        patients_result = search_patient('Nothing','','','')
        patients_result["empty_results"] | should | be(True)    
        patients_result["empty_fields"] | should | be(False)
        patients_result["patients"].count() | should | be(0)

        #Search for empty fields
        patients_result = search_patient('','','','')
        patients_result["empty_fields"] | should | be(True)
Пример #2
0
    def create_patient(self):
        from patients.models import Paciente

        patient = Paciente()
        patient.codigo = 1
        patient.nome = 'Test Patient'
        patient.cpf = '11111111111'
        patient.nome_mae = 'Patient Mother'
        patient.nome_pai = 'Patient Father'
        patient.dt_nascimento = timezone.now()
        patient.nac_codigo = 1
        patient.cor = 'Test Color'
        patient.sexo = 'Male'
        patient.naturalidade = 'Test'
        patient.prontuario = 111111111
        patient.dt_obito = timezone.now()
        patient.rg = '111'
        patient.observacao = ''
        patient.prnt_ativo = 'Active'
        patient.sexo_biologico = 'Male'
        patient.nro_cartao_saude = 1111111
        patient.save(using='hub')