diff --git a/tests/test_administration.py b/tests/test_administration.py index e7940005df3deccaafe293f4dca6eeea6c2c7097..6a2d7421cdcdbbfa429ea6c5d26581bdbadefc3b 100644 --- a/tests/test_administration.py +++ b/tests/test_administration.py @@ -29,8 +29,8 @@ from caosdb import administration as admin from caosdb import get_config from caosdb.connection.connection import configure_connection, get_connection -from caosdb.exceptions import (ClientErrorException, HTTPAuthorizationException, - LoginFailedException, ResourceNotFoundException) +from caosdb.exceptions import (HTTPClientError, HTTPAuthorizationError, + LoginFailedError, ResourceNotFoundError) from nose.tools import (assert_equal, assert_is_not_none, assert_raises, assert_true) from pytest import raises @@ -105,14 +105,14 @@ def test_insert_role_success(): def test_insert_role_failure_permission(): switch_to_normal_user() - with raises(HTTPAuthorizationException) as cm: + with raises(HTTPAuthorizationError) as cm: admin._insert_role(name=test_role, description=test_role_desc) assert cm.value.msg == "You are not permitted to insert a new role." def test_insert_role_failure_name_duplicates(): test_insert_role_success() - with assert_raises(ClientErrorException) as cm: + with assert_raises(HTTPClientError) as cm: admin._insert_role(name=test_role, description=test_role_desc) assert_equal( cm.exception.msg, @@ -131,13 +131,13 @@ def test_update_role_success(): def test_update_role_failure_permissions(): test_insert_role_success() switch_to_normal_user() - with raises(HTTPAuthorizationException) as cm: + with raises(HTTPAuthorizationError) as cm: admin._update_role(name=test_role, description=test_role_desc + "asdf") assert cm.value.msg == "You are not permitted to update this role." def test_update_role_failure_non_existing(): - with raises(ResourceNotFoundException) as cm: + with raises(ResourceNotFoundError) as cm: admin._update_role(name=test_role, description=test_role_desc + "asdf") assert cm.value.msg == "Role does not exist." @@ -150,13 +150,13 @@ def test_delete_role_success(): def test_delete_role_failure_permissions(): test_insert_role_success() switch_to_normal_user() - with raises(HTTPAuthorizationException) as cm: + with raises(HTTPAuthorizationError) as cm: admin._delete_role(name=test_role) assert cm.value.msg == "You are not permitted to delete this role." def test_delete_role_failure_non_existing(): - with raises(ResourceNotFoundException) as cm: + with raises(ResourceNotFoundError) as cm: admin._delete_role(name=test_role) assert cm.value.msg == "Role does not exist." @@ -170,13 +170,13 @@ def test_retrieve_role_success(): def test_retrieve_role_failure_permission(): test_insert_role_success() switch_to_normal_user() - with raises(HTTPAuthorizationException) as cm: + with raises(HTTPAuthorizationError) as cm: admin._retrieve_role(name=test_role) assert cm.value.msg == "You are not permitted to retrieve this role." def test_retrieve_role_failure_non_existing(): - with raises(ResourceNotFoundException) as cm: + with raises(ResourceNotFoundError) as cm: admin._retrieve_role(name=test_role) assert cm.value.msg == "Role does not exist." @@ -195,7 +195,7 @@ def test_set_permissions_success(): def test_set_permissions_failure_permissions(): test_insert_role_success() switch_to_normal_user() - with raises(HTTPAuthorizationException) as cm: + with raises(HTTPAuthorizationError) as cm: admin._set_permissions( role=test_role, permission_rules=[ admin.PermissionRule( @@ -204,7 +204,7 @@ def test_set_permissions_failure_permissions(): def test_set_permissions_failure_non_existing(): - with raises(ResourceNotFoundException) as cm: + with raises(ResourceNotFoundError) as cm: admin._set_permissions( role=test_role, permission_rules=[ admin.PermissionRule( @@ -222,13 +222,13 @@ def test_get_permissions_success(): def test_get_permissions_failure_permissions(): test_set_permissions_success() switch_to_normal_user() - with raises(HTTPAuthorizationException) as cm: + with raises(HTTPAuthorizationError) as cm: admin._get_permissions(role=test_role) assert cm.value.msg == "You are not permitted to retrieve this role's permissions." def test_get_permissions_failure_non_existing(): - with raises(ResourceNotFoundException) as cm: + with raises(ResourceNotFoundError) as cm: admin._get_permissions(role="non-existing-role") assert cm.value.msg == "Role does not exist." @@ -244,13 +244,13 @@ def test_get_roles_success(): def test_get_roles_failure_permissions(): test_insert_role_success() switch_to_normal_user() - with raises(HTTPAuthorizationException) as cm: + with raises(HTTPAuthorizationError) as cm: admin._get_roles(username=test_user) assert cm.value.msg == "You are not permitted to retrieve this user's roles." def test_get_roles_failure_non_existing(): - with raises(ResourceNotFoundException) as cm: + with raises(ResourceNotFoundError) as cm: admin._get_roles(username="non-existing-user") assert cm.value.msg == "User does not exist." @@ -277,14 +277,14 @@ def test_set_roles_failure_permissions(): roles = {test_role} roles.union(roles_old) switch_to_normal_user() - with raises(HTTPAuthorizationException) as cm: + with raises(HTTPAuthorizationError) as cm: admin._set_roles(username=test_user, roles=roles_old) assert cm.value.msg == "You are not permitted to set this user's roles." def test_set_roles_failure_non_existing_role(): roles = {"non-existing-role"} - with assert_raises(ClientErrorException) as cm: + with assert_raises(HTTPClientError) as cm: admin._set_roles(username=test_user, roles=roles) assert_equal(cm.exception.msg, "Role does not exist.") @@ -292,7 +292,7 @@ def test_set_roles_failure_non_existing_role(): def test_set_roles_failure_non_existing_user(): test_insert_role_success() roles = {test_role} - with raises(ResourceNotFoundException) as cm: + with raises(ResourceNotFoundError) as cm: admin._set_roles(username="non-existing-user", roles=roles) assert cm.value.msg == "User does not exist." @@ -308,7 +308,7 @@ def test_insert_user_success(): def test_insert_user_failure_permissions(): switch_to_normal_user() - with raises(HTTPAuthorizationException) as cm: + with raises(HTTPAuthorizationError) as cm: admin._insert_user( name=test_user, password="secret1P!", @@ -320,7 +320,7 @@ def test_insert_user_failure_permissions(): def test_insert_user_failure_name_in_use(): test_insert_user_success() - with assert_raises(ClientErrorException) as cm: + with assert_raises(HTTPClientError) as cm: test_insert_user_success() assert_equal(cm.exception.msg, "User name is already in use.") @@ -333,13 +333,13 @@ def test_delete_user_success(): def test_delete_user_failure_permissions(): test_insert_user_success() switch_to_normal_user() - with raises(HTTPAuthorizationException) as cm: + with raises(HTTPAuthorizationError) as cm: admin._delete_user(name="non_existing_user") assert cm.value.msg == "You are not permitted to delete this user." def test_delete_user_failure_non_existing(): - with raises(ResourceNotFoundException) as cm: + with raises(ResourceNotFoundError) as cm: admin._delete_user(name="non_existing_user") assert cm.value.msg == "User does not exist." @@ -413,7 +413,7 @@ def test_update_user_failure_permissions_status(): status="INACTIVE", email="email@example.com", entity=None) is not None switch_to_normal_user() - with raises(HTTPAuthorizationException) as cm: + with raises(HTTPAuthorizationError) as cm: admin._update_user( realm=None, name=test_user + "2", @@ -429,7 +429,7 @@ def test_update_user_failure_permissions_email(): password="secret1P!", status="ACTIVE", email="email@example.com", entity=None) is not None switch_to_normal_user() - with raises(HTTPAuthorizationException) as cm: + with raises(HTTPAuthorizationError) as cm: admin._update_user( realm=None, name=test_user + "2", @@ -445,7 +445,7 @@ def test_update_user_failure_permissions_entity(): password="secret1P!", status="ACTIVE", email="email@example.com", entity=None) is not None switch_to_normal_user() - with raises(HTTPAuthorizationException) as cm: + with raises(HTTPAuthorizationError) as cm: admin._update_user( realm=None, name=test_user + "2", @@ -461,7 +461,7 @@ def test_update_user_failure_permissions_password(): password="secret1P!", status="ACTIVE", email="email@example.com", entity=None) is not None switch_to_normal_user() - with raises(HTTPAuthorizationException) as cm: + with raises(HTTPAuthorizationError) as cm: admin._update_user( realm=None, name=test_user + "2", @@ -473,7 +473,7 @@ def test_update_user_failure_permissions_password(): def test_update_user_failure_non_existing_user(): - with raises(ResourceNotFoundException) as cm: + with raises(ResourceNotFoundError) as cm: admin._update_user( realm=None, name="non-existing-user", @@ -488,7 +488,7 @@ def test_update_user_failure_non_existing_entity(): assert admin._insert_user(name=test_user + "2", password="secret1P!", status="ACTIVE", email="email@example.com", entity=None) is not None - with raises(ClientErrorException) as cm: + with raises(HTTPClientError) as cm: admin._update_user( realm=None, name=test_user + "2", @@ -507,13 +507,13 @@ def test_retrieve_user_success(): def test_retrieve_user_failure_permissions(): test_insert_user_success() switch_to_normal_user() - with raises(HTTPAuthorizationException) as cm: + with raises(HTTPAuthorizationError) as cm: admin._retrieve_user(realm=None, name=test_user + "2") assert cm.value.msg == "You are not permitted to retrieve this user." def test_retrieve_user_failure_non_existing(): - with raises(ResourceNotFoundException) as cm: + with raises(ResourceNotFoundError) as cm: admin._retrieve_user(realm=None, name="non_existing") assert cm.value.msg == "User does not exist." @@ -528,5 +528,5 @@ def test_login_with_inactive_user_failure(): entity=None)) configure_connection(username=test_user + "2", password="secret1P!", password_method="plain") - with assert_raises(LoginFailedException): + with assert_raises(LoginFailedError): get_connection()._login() diff --git a/tests/test_authentication.py b/tests/test_authentication.py index ce2a095bab5f6b2d70afbea1a2a96af624c71389..e064b59973e90a195e47cf118aec08de00a2203d 100644 --- a/tests/test_authentication.py +++ b/tests/test_authentication.py @@ -33,7 +33,7 @@ import ssl from subprocess import call from lxml import etree from pytest import raises, mark -from caosdb.exceptions import LoginFailedException +from caosdb.exceptions import LoginFailedError import caosdb as db from .test_server_side_scripting import request @@ -86,7 +86,7 @@ def test_https_support(): def test_login_via_post_form_data_failure(): - with raises(LoginFailedException): + with raises(LoginFailedError): db.get_connection().post_form_data( "login", { "username": db.get_config().get("Connection", "username"), @@ -199,7 +199,7 @@ def test_one_time_token_invalid(): db.configure_connection(password_method="auth_token", auth_token=auth_token) - with raises(db.LoginFailedException) as lfe: + with raises(db.LoginFailedError) as lfe: db.Info() assert lfe.value.args[0] == ( "The authentication token is expired or you have been logged out otherwise. The auth_token " @@ -210,7 +210,7 @@ def test_one_time_token_invalid(): db.administration.set_server_property("AUTH_OPTIONAL", "TRUE") db.configure_connection(password_method="auth_token", auth_token=auth_token) - with raises(db.LoginFailedException) as lfe: + with raises(db.LoginFailedError) as lfe: db.Info() assert lfe.value.args[0] == ( "The authentication token is expired or you have been logged out otherwise. The auth_token " @@ -221,7 +221,7 @@ def test_one_time_token_expired(): auth_token = get_one_time_token("admin_token_expired") db.configure_connection(password_method="auth_token", auth_token=auth_token) - with raises(db.LoginFailedException) as lfe: + with raises(db.LoginFailedError) as lfe: db.Info() assert lfe.value.args[0] == ( "The authentication token is expired or you have been logged out otherwise. The auth_token " @@ -232,7 +232,7 @@ def test_one_time_token_expired(): db.administration.set_server_property("AUTH_OPTIONAL", "TRUE") db.configure_connection(password_method="auth_token", auth_token=auth_token) - with raises(db.LoginFailedException) as lfe: + with raises(db.LoginFailedError) as lfe: db.Info() assert lfe.value.args[0] == ( "The authentication token is expired or you have been logged out otherwise. The auth_token " @@ -273,7 +273,7 @@ def test_one_time_token_3_attempts(): db.configure_connection(password_method="auth_token", auth_token=auth_token) assert db.get_connection()._authenticator.auth_token == auth_token - with raises(db.LoginFailedException) as lfe: + with raises(db.LoginFailedError) as lfe: db.Info() assert lfe.value.args[0] == ( "The authentication token is expired or you have been logged out otherwise. The auth_token " @@ -286,7 +286,7 @@ def test_one_time_token_3_attempts(): db.configure_connection(password_method="auth_token", auth_token=auth_token) assert db.get_connection()._authenticator.auth_token == auth_token - with raises(db.LoginFailedException) as lfe: + with raises(db.LoginFailedError) as lfe: db.Info() assert lfe.value.args[0] == ( "The authentication token is expired or you have been logged out otherwise. The auth_token " diff --git a/tests/test_misc.py b/tests/test_misc.py index 30edb1c21370c6ca7fd5dbe1daec7313f97728bc..0da3bffd7b48cd7840ee106954489befe210eb15 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -194,7 +194,7 @@ def test_parent_duplicate_2(): def test_server_error(): con = db.get_connection() con._login() - with raises(db.ServerErrorException) as cm: + with raises(db.HTTPServerError) as cm: con._http_request( method="GET", path="Entity?debug=throwNullPointerException") diff --git a/tests/test_permissions.py b/tests/test_permissions.py index 0c54ffcbb9549d457eb061660062ad632f9e3e80..0c194e4b02a0ea485e58075a4cb32887014057cb 100644 --- a/tests/test_permissions.py +++ b/tests/test_permissions.py @@ -116,7 +116,7 @@ def insert_test_user(): except BaseException: pass - with assert_raises(db.ClientErrorException) as cee: + with assert_raises(db.HTTPClientError) as cee: db.administration._insert_user( name=test_user, password=easy_pw, @@ -345,7 +345,7 @@ def test_update_acl(): permission="USE:AS_PROPERTY") with raises(db.TransactionError) as te: p3.update_acl() - assert te.value.has_error(db.AuthorizationException) + assert te.value.has_error(db.AuthorizationError) p3 = db.execute_query( "FIND TestProperty", @@ -366,7 +366,7 @@ def test_update_acl(): p3.acl.grant(username=test_user, permission="EDIT:ACL") with raises(db.TransactionError) as te: p3.update() - assert te.value.has_error(db.AuthorizationException) + assert te.value.has_error(db.AuthorizationError) @ with_setup(setup, teardown) @@ -395,7 +395,7 @@ def test_update_name(): p.name = "TestPropertyEvenNewer" with raises(db.TransactionError) as te: p.update() - assert te.value.has_error(db.AuthorizationException) + assert te.value.has_error(db.AuthorizationError) p2 = db.execute_query("FIND Test*", unique=True) assert p2.is_valid() @@ -429,7 +429,7 @@ def test_update_desc(): p.description = "DescriptionEvenNewer" with raises(db.TransactionError) as te: p.update() - assert te.value.has_error(db.AuthorizationException) + assert te.value.has_error(db.AuthorizationError) p2 = db.execute_query("FIND Test*", unique=True) assert p2.is_valid() @@ -459,7 +459,7 @@ def test_update_data_type(): p.datatype = db.DOUBLE with raises(db.TransactionError) as te: p.update() - assert te.value.has_error(db.AuthorizationException) + assert te.value.has_error(db.AuthorizationError) p2 = db.execute_query("FIND Test*", unique=True) assert p2.is_valid() @@ -487,7 +487,7 @@ def test_update_role(): rec = db.Record(name="TestProperty").retrieve() with raises(db.TransactionError) as te: rec.update() - assert te.value.has_error(db.AuthorizationException) + assert te.value.has_error(db.AuthorizationError) rt2 = db.execute_query("FIND Test*", unique=True) assert rt2.is_valid() @@ -522,7 +522,7 @@ def test_update_move_file(): f.path = "/againotherpermissiontestfiles/test.dat" with raises(db.TransactionError) as te: f.update() - assert te.value.has_error(db.AuthorizationException) + assert te.value.has_error(db.AuthorizationError) f2 = db.execute_query("FIND TestFile", unique=True) assert f2.path == "/otherpermissiontestfiles/test.dat" @@ -544,7 +544,7 @@ def test_update_add_file(): f.file = upload_file with raises(db.TransactionError) as te: f.update() - assert te.value.has_error(db.AuthorizationException) + assert te.value.has_error(db.AuthorizationError) f2 = db.execute_query("FIND TestFile", unique=True) assert f2.path is None @@ -586,7 +586,7 @@ def test_update_change_file(): f.file = upload_file2 with raises(db.TransactionError) as te: f.update() - assert te.value.has_error(db.AuthorizationException) + assert te.value.has_error(db.AuthorizationError) f2 = db.execute_query("FIND TestFile", unique=True) download_file = f2.download() @@ -646,7 +646,7 @@ def test_update_add_property(): rt.add_property(name="TestProperty", id=p.id) with raises(db.TransactionError) as te: rt.update() - assert te.value.has_error(db.AuthorizationException) + assert te.value.has_error(db.AuthorizationError) rt2 = db.execute_query("FIND TestRecordType", unique=True) assert len(rt2.get_properties()) == 1 @@ -656,7 +656,7 @@ def test_update_add_property(): rt.add_property(name="TestProperty2", id=p2.id) with raises(db.TransactionError) as te: rt.update() - assert te.value.has_error(db.AuthorizationException) + assert te.value.has_error(db.AuthorizationError) rt2 = db.execute_query("FIND TestRecordType", unique=True) assert len(rt2.get_properties()) == 1 @@ -702,7 +702,7 @@ def test_update_remove_property(): rt.remove_property("TestProperty") with raises(db.TransactionError) as te: rt.update() - assert te.value.has_error(db.AuthorizationException) + assert te.value.has_error(db.AuthorizationError) rt2 = db.execute_query("FIND TestRecordType", unique=True) assert len(rt2.get_properties()) == 1 @@ -741,7 +741,7 @@ def test_update_add_parent(): rt.add_parent(name="TestRecordTypePar1", id=par1.id) with raises(db.TransactionError) as te: rt.update() - assert te.value.has_error(db.AuthorizationException) + assert te.value.has_error(db.AuthorizationError) rt2 = db.execute_query("FIND TestRecordType", unique=True) assert len(rt2.get_parents()) == 1 @@ -751,7 +751,7 @@ def test_update_add_parent(): rt.add_parent(name="TestRecordTypePar2", id=par2.id) with raises(db.TransactionError) as te: rt.update() - assert te.value.has_error(db.AuthorizationException) + assert te.value.has_error(db.AuthorizationError) rt2 = db.execute_query("FIND TestRecordType", unique=True) assert len(rt2.get_parents()) == 1 @@ -795,7 +795,7 @@ def test_update_remove_parent(): rt.remove_parent("TestRecordTypePar1") with raises(db.TransactionError) as te: rt.update() - assert te.value.has_error(db.AuthorizationException) + assert te.value.has_error(db.AuthorizationError) rt = db.execute_query("FIND TestRecordType", unique=True) assert len(rt.get_parents()) == 1 @@ -832,7 +832,7 @@ def test_update_value(): p.value = "EvenNewerValue" with raises(db.TransactionError) as te: p.update() - assert te.value.has_error(db.AuthorizationException) + assert te.value.has_error(db.AuthorizationError) p2 = db.execute_query("FIND Test*", unique=True) assert p2.is_valid() @@ -851,7 +851,7 @@ def test_deletion(): assert p.is_valid() with raises(db.TransactionError) as te: p.delete() - assert te.value.has_error(db.AuthorizationException) + assert te.value.has_error(db.AuthorizationError) '''Success''' grant_permission(p, "DELETE") @@ -875,7 +875,7 @@ def test_retrieve_acl(): with raises(db.TransactionError) as te: p.retrieve_acl() - assert te.value.has_error(db.AuthorizationException) + assert te.value.has_error(db.AuthorizationError) def test_retrieve_history(): @@ -890,7 +890,7 @@ def test_retrieve_history(): '''Failure''' with raises(db.TransactionError) as te: p.retrieve(flags={"H": None}) - assert te.value.has_error(db.AuthorizationException) + assert te.value.has_error(db.AuthorizationError) '''Success''' grant_permission(p, "RETRIEVE:HISTORY") @@ -915,7 +915,7 @@ def test_retrieve_entity(): with raises(db.TransactionError) as te: p.retrieve() - assert te.value.has_error(db.AuthorizationException) + assert te.value.has_error(db.AuthorizationError) @with_setup(setup, teardown) @@ -929,7 +929,7 @@ def test_retrieve_owner(): with raises(db.TransactionError) as te: p.retrieve(flags={"owner": None}) - assert te.value.has_error(db.AuthorizationException) + assert te.value.has_error(db.AuthorizationError) '''Success''' grant_permission(p, "RETRIEVE:OWNER") @@ -955,7 +955,7 @@ def test_download_file(): grant_permission(f2, "RETRIEVE:ENTITY") deny_permission(f2, "RETRIEVE:FILE") - with raises(db.HTTPAuthorizationException): + with raises(db.HTTPAuthorizationError): f.download() '''SUCCESS''' @@ -975,14 +975,14 @@ def test_grant_priority_permission(): with raises(db.TransactionError) as te: # other user cannot delete this. p.delete() - assert te.value.has_error(db.AuthorizationException) + assert te.value.has_error(db.AuthorizationError) deny_permission(p, "DELETE") with raises(db.TransactionError) as te: # still not working p.delete() - assert te.value.has_error(db.AuthorizationException) + assert te.value.has_error(db.AuthorizationError) # now its working grant_permission(p, "DELETE", priority=True) @@ -997,14 +997,14 @@ def test_deny_priority_permission(): with raises(db.TransactionError) as te: # other user cannot delete this. p.delete() - assert te.value.has_error(db.AuthorizationException) + assert te.value.has_error(db.AuthorizationError) deny_permission(p, "DELETE") with raises(db.TransactionError) as te: # still not working p.delete() - assert te.value.has_error(db.AuthorizationException) + assert te.value.has_error(db.AuthorizationError) # now it's working grant_permission(p, "DELETE") @@ -1013,7 +1013,7 @@ def test_deny_priority_permission(): with raises(db.TransactionError) as te: # still not working p.delete() - assert te.value.has_error(db.AuthorizationException) + assert te.value.has_error(db.AuthorizationError) @with_setup(setup, teardown) @@ -1030,7 +1030,7 @@ def test_change_priority_permission(): with raises(db.TransactionError) as te: entity.update_acl() - assert te.value.has_error(db.AuthorizationException) + assert te.value.has_error(db.AuthorizationError) @with_setup(setup, teardown) @@ -1099,7 +1099,7 @@ def test_use_as_data_type(): deny_permission(dt, "USE:AS_DATA_TYPE") with raises(db.TransactionError) as cm: db.Property(name="TestConductorProperty2", datatype=dt_name).insert() - assert cm.value.has_error(db.AuthorizationException) + assert cm.value.has_error(db.AuthorizationError) @with_setup(setup, teardown) @@ -1170,7 +1170,7 @@ def test_access_control_job_bug(): switch_to_test_user() with raises(db.TransactionError) as te: rt1 = db.RecordType(name="TestRT").add_parent(id=-5).insert() - assert te.value.has_error(db.AuthorizationException) + assert te.value.has_error(db.AuthorizationError) set_transaction_permissions_test_role() diff --git a/tests/test_server_side_scripting.py b/tests/test_server_side_scripting.py index ef0498cede01f96bfbceb305b87e7edf1083d95c..7ad0325194da506b1efce724c97b6ac855f2a54a 100644 --- a/tests/test_server_side_scripting.py +++ b/tests/test_server_side_scripting.py @@ -33,8 +33,8 @@ from lxml import etree from http.client import HTTPSConnection import ssl from caosdb import get_connection, get_config, Info, execute_query, RecordType -from caosdb.exceptions import (ClientErrorException, - ResourceNotFoundException) +from caosdb.exceptions import (HTTPClientError, + ResourceNotFoundError) from caosdb.connection.encode import MultipartParam, multipart_encode from caosdb.connection.utils import urlencode, urlparse from caosdb import administration as admin @@ -109,7 +109,7 @@ def teardown_module(): def test_call_script_non_existing(): form = dict() form["call"] = "non_existing_script" - with raises(ResourceNotFoundException): + with raises(ResourceNotFoundError): get_connection().post_form_data("scripting", form) @@ -118,7 +118,7 @@ def test_call_script_not_executable(): _SERVER_SIDE_SCRIPTING_BIN_DIR_SERVER) form = dict() form["call"] = "not_executable" - with raises(ClientErrorException) as exc_info: + with raises(HTTPClientError) as exc_info: get_connection().post_form_data("scripting", form) assert "not executable" in exc_info.value.body.decode("utf-8") diff --git a/tests/test_tickets.py b/tests/test_tickets.py index 63313c48ed7931cbd1f6315e17e31cd2090029e9..e9a80a43e74967ae13ba1165bd08bce4486ae91c 100644 --- a/tests/test_tickets.py +++ b/tests/test_tickets.py @@ -26,7 +26,7 @@ @author: tf """ import caosdb as db -from caosdb.exceptions import (AmbiguityException, CaosDBException, +from caosdb.exceptions import (CaosDBException, EntityDoesNotExistError, EntityError, TransactionError, UniqueNamesError) from nose.tools import (assert_equal, assert_false, assert_is_none, diff --git a/tests/test_tickets_200.py b/tests/test_tickets_200.py index b3dbd003e1693ea08884facf68db01a9ae8e9805..eed1cbd2f91786383de65b0d6da290f476bbd5ed 100644 --- a/tests/test_tickets_200.py +++ b/tests/test_tickets_200.py @@ -199,7 +199,7 @@ def test_ticket_232(): for i in range(1000): uri.append("longname" + str(i)) - # with raises(h.URITooLongException) as exc_info: + # with raises(h.URITooLongError) as exc_info: # h.get_connection().retrieve(uri) c = h.Container().extend(uri).retrieve(raise_exception_on_error=False)