Exemplo n.º 1
0
    def update_incorrect_type(self):
        subject_list = subject_dal.get_all()
        old_subject = subject_list[0]
        oid = old_subject["subjectId"]

        subject_bll.update(oid, "Asignatura Muy Nueva", "AMN", 12, 1,
                           "Inexistente", 1, 1)
Exemplo n.º 2
0
    def update_incorrect_course(self):
        subject_list = subject_dal.get_all()
        old_subject = subject_list[0]
        oid = old_subject["subjectId"]

        subject_bll.update(oid, "Asignatura Muy Nueva", "AMN", 12, -4,
                           "Obligatoria", 1, 1)
Exemplo n.º 3
0
    def update_same_name(self):
        subject_list = subject_dal.get_all()
        old_subject = subject_list[0]
        other_subject = subject_list[1]
        oid = old_subject["subjectId"]

        subject_bll.update(oid, other_subject["name"], "AMN", 12, 1,
                           "Obligatoria", 1, 1)
Exemplo n.º 4
0
    def update_success(self):
        subject_list = subject_dal.get_all()
        old_subject = subject_list[0]
        oid = old_subject["subjectId"]

        subject_bll.update(oid, "Asignatura Muy Nueva", "AMN", 12, 1,
                           "Obligatoria", 1, 1)

        subject = subject_dal.get_by_name(old_subject["name"])
        if subject is not None:
            raise BLLException(
                "The subject has the same name as before the change")

        subject = subject_dal.get_by_name("Asignatura Muy Nueva")
        if subject is None:
            raise BLLException("The subject has not got the new name")
Exemplo n.º 5
0
    def update_same_acronym(self):
        subject_list = subject_dal.get_all()
        old_subject = subject_list[0]
        other_subject = subject_list[1]
        oid = old_subject["subjectId"]

        subject_bll.update(
            oid,
            "Asignatura Muy Nueva",
            other_subject["acronym"],
            12,
            1,
            "Obligatoria",
            1,
            1,
        )
Exemplo n.º 6
0
def update(oid: int):
    """Updates an existing subject"""
    subject_fields: tuple = get_fields()

    res: Tuple[Response, int]

    try:
        new_oid = subject_bll.update(oid, *subject_fields)
        res = jsonify({"oid": new_oid}), 200
    except BLLException as exc:
        error = {"error": str(exc)}
        res = jsonify(error), 400

    return res
Exemplo n.º 7
0
    def update_incorrect_name(self):
        subject_list = subject_dal.get_all()
        old_subject = subject_list[0]
        oid = old_subject["subjectId"]

        subject_bll.update(oid, " ", "AMN", 12, 1, "Obligatoria", 1, 1)