Exemple #1
0
    def test_valid_not_executed_review(self):
        request = construct_dummy_request(json_body={'': ''})
        fn = valid_not_executed_review('key', ReviewEdit)
        response = fn(request)
        self.assertFalse(response)
        self.assertEqual(bool, type(response))

        request = construct_dummy_request(json_body={'uid': 1000})
        fn = valid_not_executed_review('uid', ReviewEdit)
        response = fn(request)
        self.assertFalse(response)
        self.assertEqual(bool, type(response))

        db_edit = DBDiscussionSession.query(ReviewEdit).filter_by(is_executed=False).first()
        request = construct_dummy_request(json_body={'uid': db_edit.uid})
        fn = valid_not_executed_review('uid', ReviewEdit)
        response = fn(request)
        self.assertTrue(response)
        self.assertEqual(bool, type(response))
Exemple #2
0
    """
    LOG.debug("Flag a premisegroup for split or merge. %s", request.params)
    ui_locales = get_discussion_language(request.matchdict, request.params,
                                         request.session)
    _tn = Translator(ui_locales)
    db_user = request.validated['user']
    pgroup = request.validated['pgroup']
    key = request.validated['key']

    if key not in [key_merge, key_split]:
        raise HTTPBadRequest()
    return flag_pgroup_for_merge_or_split(key, pgroup, db_user, _tn)


@view_config(route_name='review_delete_argument', renderer='json')
@validate(valid_user, valid_not_executed_review('review_uid', ReviewDelete),
          has_keywords_in_json_path(('should_delete', bool)))
def review_delete_argument(request):
    """
    Values for the review for an argument, which should be deleted

    :param request: current request of the server
    :return: json-dict()
    """
    LOG.debug("Review an argument-delete request. %s", request.json_body)
    ui_locales = get_discussion_language(request.matchdict, request.params,
                                         request.session)
    db_review = request.validated['db_review']
    db_user = request.validated['user']
    should_delete = request.validated['should_delete']
    main_page = request.application_url
Exemple #3
0
 def test_valid_not_executed_review_error(self):
     request = construct_dummy_request(json_body={'ruid': 1})
     response = valid_not_executed_review('ruid', ReviewDelete)(request)
     self.assertFalse(response)
Exemple #4
0
 def test_valid_not_executed_review(self):
     request = construct_dummy_request({'ruid': 4})
     response = valid_not_executed_review('ruid', ReviewDelete)(request)
     self.assertTrue(response)