Ejemplo n.º 1
0
    def delete_documents():
        print('\n\033[01m## Deletion ##\033[0m')
        make_test(lambda: DocController.delete_documents(2))(
            DocumentTest, 'existing document', False)

        make_test(lambda: DocController.delete_documents(2))(
            DocumentTest, 'non existing document', True)
Ejemplo n.º 2
0
 def test_delete_document_as_contributor(self):
     print('Delete a document as contributor')
     with pytest.raises(AuthError):
         DocController.delete_documents(4, {
             'user_id': 2,
             'role': {
                 'label': 'contributor'
             }
         })
Ejemplo n.º 3
0
 def test_delete_document_as_admin(self):
     print('Delete a document as admin')
     try:
         DocController.delete_documents(4, {
             'user_id': 1,
             'role': {
                 'label': 'admin'
             }
         })
     except Exception as e:
         print(e)
Ejemplo n.º 4
0
 def test_delete_document(self):
     print("delete a document")
     expected_response = None
     assert expected_response == DocController.delete_documents(
         1, {
             'user_id': 1,
             "role": {
                 'label': 'admin'
             }
         })
Ejemplo n.º 5
0
def delete_document(doc_id, auth_info):
    deleted_document = DocController.delete_documents(doc_id, auth_info)
    return ResponseOK(deleted_document)
Ejemplo n.º 6
0
def delete_document(doc_id):
    return send_response(lambda: DocController.delete_documents(doc_id))()