Beispiel #1
0
def update_comment(comment_id, auth_info):
    form = {key: request.form.get(key) for key in request.form.keys()}
    args = {}
    args.update(auth_info)
    args.update(form)
    updated_comment = CommentController.update_comment(comment_id, args)
    return ResponseOK(updated_comment)
Beispiel #2
0
def create_comment(doc_id, auth_info):
    form = {key: request.form.get(key) for key in request.form.keys()}
    args = {}
    args.update(auth_info)
    args.update(form)
    comment = CommentController.create_comment(doc_id, args)
    return ResponseCreated(comment)
 def test_get_comments(self):
     print("get comments")
     expected_response = [{
         'description': 'ok_1',
         'id': 1,
         'user_id': 1,
         'doc_id': 1,
         'date': FAKE_TIME
     }]
     assert expected_response == CommentController.get_comments(1)
Beispiel #4
0
 def test_create_comment_2(self, patch_datetime_now):
     print("Create a comment")
     expected_response = {
         'id': 2,
         'user_id': 1,
         'doc_id': 1,
         'description': 'ok_2',
         'date': FAKE_TIME
     }
     assert expected_response == CommentController.create_comment(1, {
         'user_id': 1,
         'description': 'ok_2'
     })
Beispiel #5
0
 def test_delete_comment(self):
     print("delete a comment")
     expected_response = {
         'id': 2,
         'user_id': 1,
         'doc_id': 1,
         'description': 'ok_2',
         'date': FAKE_TIME
     }
     assert expected_response == CommentController.delete_comment(2, {
         'user_id': 1,
         "role": {
             'label': 'admin'
         }
     })
Beispiel #6
0
 def test_update_comment(self):
     print("update a comment")
     expected_response = {
         'doc_id': 1,
         'user_id': 1,
         'description': 'ok_1',
         'id': 1,
         'date': FAKE_TIME
     }
     assert expected_response == CommentController.update_comment(1, {
         'id': 1,
         'user_id': 1,
         "role": {
             'label': 'admin'
         },
         'description': 'ok_1'
     })
Beispiel #7
0
def delete_comment(comment_id, auth_info):
    deleted_comment = CommentController.delete_comment(comment_id, auth_info)
    return ResponseOK(deleted_comment)
Beispiel #8
0
def get_comment_by_id(comment_id):
    comment = CommentController.get_comment(comment_id)
    return ResponseOK(comment)
Beispiel #9
0
def get_comment(doc_id, auth_info):
    DocController.get_document_by_id(doc_id, auth_info)
    comments = CommentController.get_comments(doc_id)
    return ResponseOK(comments)