コード例 #1
0
    def test_valid_uuid_is_valid(self):
        """
        Tests if the method validate_uuid validates a correct uuid
        """

        try:
            Utils.validate_uuid(UtilsDataRepository.get_valid_uuid())
        except ValidationError:
            self.fail('There should be no validation error.')
コード例 #2
0
    def is_valid_goniometry(goniometry_id):
        """
        Checks if the specified goniometry exists

        :param goniometry_id: if of the goniometry
        """

        Utils.validate_uuid(goniometry_id)

        if not Goniometry.objects.filter(id=goniometry_id).exists():
            raise ValidationError("The goniometry is not valid!")
コード例 #3
0
    def is_valid_muscle_test(muscle_test_id):
        """
        Checks if the specified muscle_test exists

        :param muscle_test_id: if of the muscle_test
        """

        Utils.validate_uuid(muscle_test_id)

        if not MuscleTest.objects.filter(id=muscle_test_id).exists():
            raise ValidationError("The muscle test is not valid!")
コード例 #4
0
    def is_valid_perimetry(perimetry_id):
        """
        Checks if the specified perimetry exists

        :param perimetry_id: if of the perimetry
        """

        Utils.validate_uuid(perimetry_id)

        if not Perimetry.objects.filter(id=perimetry_id).exists():
            raise ValidationError("The perimetry is not valid!")
コード例 #5
0
    def is_valid_physiotherapist(id_physiotherapist):
        """
        Checks if the specified physiotherapist exists

        :param id_physiotherapist: ID of physiotherapist to be checked
        """

        Utils.validate_uuid(id_physiotherapist)

        if not Physiotherapist.objects.filter(id=id_physiotherapist).exists():
            raise ValidationError("The physiotherapist is not valid!")
コード例 #6
0
    def is_valid_treatment(treatment_id):
        """
        Checks if the specified treatment exists

        :param treatment_id: if of the treatment
        """

        Utils.validate_uuid(treatment_id)

        if not Treatment.objects.filter(id=treatment_id).exists():
            raise ValidationError("The treatment is not valid!")
コード例 #7
0
    def is_valid_state(id_state):
        """
        Checks if the specified state exists

        :param id_state: ID of state to be checked
        """

        Utils.validate_uuid(id_state)

        if not State.objects.filter(id=id_state).exists():
            raise ValidationError("The state is not valid!")
コード例 #8
0
    def is_valid_person(id_person):
        """
        Checks if the specified person exists

        :param id_person: ID of person to be checked
        """

        Utils.validate_uuid(id_person)

        if not Person.objects.filter(id=id_person).exists():
            raise ValidationError("The person is not valid!")
コード例 #9
0
    def is_valid_patient(id_patient):
        """
        Checks if the specified patient exists

        :param id_patient: ID of patient to be checked
        """

        Utils.validate_uuid(id_patient)

        if not Patient.objects.filter(id=id_patient).exists():
            raise ValidationError("The patient is not valid!")
コード例 #10
0
    def is_valid_address(id_address):
        """
        Checks if the specified address exists

        :param id_address: ID of address to be checked
        """

        Utils.validate_uuid(id_address)

        if not Address.objects.filter(id=id_address).exists():
            raise ValidationError("The address " + id_address +
                                  " is not valid!")
コード例 #11
0
    def is_valid_body_zone(id_body_zone):
        """
        Checks if the specified body zone exists

        :param id_body_zone: ID of body zone to be checked
        """

        Utils.validate_uuid(id_body_zone)

        if not BodyZone.objects.filter(id=id_body_zone).exists():
            raise ValidationError("The body zone " + id_body_zone +
                                  " is not valid!")
コード例 #12
0
    def is_valid_administrator(id_administrator):
        """
        Checks if the specified administrator exists

        :param id_administrator: ID of administrator to be checked
        """

        Utils.validate_uuid(id_administrator)

        if not Administrator.objects.filter(id=id_administrator).exists():
            raise ValidationError("The administrator " + id_administrator +
                                  " is not valid!")
コード例 #13
0
    def is_valid_credential(id_credential):
        """
        Checks if the specified credential exists

        :param id_credential: ID of credential to be checked
        """

        Utils.validate_uuid(id_credential)

        if not Credential.objects.filter(id=id_credential).exists():
            raise ValidationError("The credential " + id_credential +
                                  " is not valid!")
コード例 #14
0
    def is_valid_treatment_cycle(id_treatment_cycle, id_patient):
        """
        Checks if the specified treatment cycle belongs to the patient

        :param id_treatment_cycle: ID of the treatment cycle
        :param id_patient: Patient where the cycle should belong to
        """

        Utils.validate_uuid(id_treatment_cycle)
        Utils.validate_uuid(id_patient)

        if not TreatmentCycle.objects.filter(id=id_treatment_cycle,
                                             patient_id=id_patient).exists():
            raise ValidationError("The treatment cycle is not valid!")
コード例 #15
0
    def get_administrator(id_administrator):
        """
        Returns the administrator with a given id

        :param id_administrator: ID of administrator
        :return: Administrator found or none
        """

        Utils.validate_uuid(id_administrator)

        try:
            admin = Administrator.objects.get(id=id_administrator)
            return AdministratorSerializer(admin).data
        except ObjectDoesNotExist:
            return None
コード例 #16
0
    def get_physiotherapist(id_physiotherapist):
        """
        Returns the physiotherapist with a given id

        :param id_physiotherapist: ID of physiotherapist
        :return: Physiotherapist found or none
        """

        Utils.validate_uuid(id_physiotherapist)

        try:
            physiotherapist = Physiotherapist.objects.get(
                id=id_physiotherapist)
            return PhysiotherapistSerializer(physiotherapist).data
        except ObjectDoesNotExist:
            return None
コード例 #17
0
    def validate_muscle_test_info_request(id_patient, id_treatment_cycle,
                                          id_treatment, id_muscle_test):
        """
        Validates the treatment information received in the request body

        :param id_patient: Id of the patient received
        :param id_treatment_cycle: Id of the treatment cycle received
        :param id_treatment: Id of the treatment received
        :param id_muscle_test: Id of the muscle test received
        """

        Utils.validate_uuid(id_patient)
        Utils.validate_uuid(id_treatment_cycle)
        Utils.validate_uuid(id_treatment)
        Utils.validate_uuid(id_muscle_test)
コード例 #18
0
    def validate_goniometry_info_request(id_patient, id_treatment_cycle,
                                         id_treatment, id_goniometry):
        """
        Validates the goniometry information received in the request

        :param id_patient: Id of the patient received
        :param id_treatment_cycle: Id of the treatment cycle received
        :param id_treatment: Id of the treatment received
        :param id_goniometry: Id of the goniometry received
        """

        Utils.validate_uuid(id_patient)
        Utils.validate_uuid(id_treatment_cycle)
        Utils.validate_uuid(id_treatment)
        Utils.validate_uuid(id_goniometry)