Ejemplo n.º 1
0
def request_obj_review(obj, reviewer):
    """Returns obj with requested review."""
    rest_service.ReviewService().create_obj({
        "reviewers": reviewer,
        "reviewable": obj.repr_min_dict()
    })
    return obj.update_attrs(review=entities_factory.ReviewsFactory().create(
        reviewers=reviewer))
Ejemplo n.º 2
0
 def program_with_assigned_reviewer(self):
     """Creates program with assigned review.
 Returns program and reviewer person."""
     reviewer = rest_facade.create_user_with_role(roles.CREATOR)
     users.set_current_user(rest_facade.create_user_with_role(
         roles.CREATOR))
     program_with_review = rest_service.ReviewService().request_review(
         rest_facade.create_program(), reviewer)
     return {"program": program_with_review, "reviewer": reviewer}
Ejemplo n.º 3
0
def approve_obj_review(obj):
    """Returns obj with approved review."""
    rest_review = get_obj_review(obj)
    rest_service.ReviewService().update_obj(
        obj=rest_review, status=element.ReviewStates.REVIEWED)
    return obj.update_attrs(review=entities_factory.ReviewsFactory().create(
        status=element.ReviewStates.REVIEWED,
        reviewers=users.current_user(),
        last_reviewed_by=users.current_user().email,
        last_reviewed_at=date_utils.iso8601_to_ui_str_with_zone(
            rest_review.last_reviewed_at)))
Ejemplo n.º 4
0
def request_obj_review(obj, reviewer):
    """Returns obj with requested review."""
    rest_service.ReviewService().create_obj({
        "reviewers": reviewer,
        "reviewable": obj.repr_min_dict()
    })
    exp_review = entities_factory.ReviewsFactory().create(
        is_add_rest_attrs=True,
        status=element.ReviewStates.UNREVIEWED,
        reviewers=reviewer)
    obj.review = exp_review.convert_review_to_dict()
    obj.review_status = exp_review.status
    return obj
Ejemplo n.º 5
0
def approve_obj_review(obj):
    """Returns obj with approved review."""
    rest_review = get_obj_review(obj)
    rest_service.ReviewService().update_obj(
        obj=rest_review, status=element.ReviewStates.REVIEWED)
    exp_review = entities_factory.ReviewsFactory().create(
        is_add_rest_attrs=True,
        status=element.ReviewStates.REVIEWED,
        reviewers=users.current_user(),
        last_reviewed_by=users.current_user().email,
        last_reviewed_at=rest_review.last_reviewed_at)
    obj.review = exp_review.convert_review_to_dict()
    obj.review_status = exp_review.status
    return obj