def test_validate_document_2(self): print('Validate a document as an admin') with pytest.raises(sqlalchemy.orm.exc.NoResultFound): DocController.validate_document(7, { 'user_id': 1, 'role': { 'label': 'admin' } }, {'user_id': 1})
def test_validate_document_1(self): print('Validate a document as contributor') with pytest.raises(AuthError): DocController.validate_document(2, { 'user_id': 2, 'role': { 'label': 'contributor' } }, {'user_id': 2})
def validate_document(auth_info): validated_document = DocController.validate_document( request.form['id'], auth_info) return ResponseOK(validated_document)