diff --git a/tests/test_issues_server.py b/tests/test_issues_server.py index 7762838c469f17b098ef7ac3e59c6ffc1b55ee42..4c4df4dc83352b09e5300c1273d0a6658a3e878a 100644 --- a/tests/test_issues_server.py +++ b/tests/test_issues_server.py @@ -27,9 +27,10 @@ import tempfile import time import caosdb as db -from caosdb import administration as admin import pytest -from caosdb.exceptions import TransactionError, HTTPClientError + +from caosdb import administration as admin +from caosdb.exceptions import (TransactionError, HTTPClientError) CURATOR_ROLE = "curator" @@ -1432,3 +1433,25 @@ See https://gitlab.indiscale.com/caosdb/src/caosdb-server/-/issues/106 # Existing Property should still be reported as TEXT assert db.Record(id=r.id).retrieve().get_property("prop").datatype == db.TEXT + + +@pytest.mark.xfail(reason="https://gitlab.com/caosdb/caosdb-server/-/issues/235") +def test_235_long_name(): + """Should give an appropriate error, not just unknown server/-/issues.""" + length = 10256 + name = "N" * length + rt1 = db.RecordType(name=name) + try: + rt1.insert() + except Exception as exc: + assert type(exc) is not db.HTTPServerError + # TODO more specific error should be asserted + + rt2 = db.RecordType(name="Short") + rt2.insert() + rt2.name = name + try: + rt2.update() + except Exception as exc: + assert type(exc) is not db.HTTPServerError + # TODO more specific error should be asserted diff --git a/tests/test_messages.py b/tests/test_messages.py index bdbf371f6961e1f46fe1577ea2134f918e4588de..dfa1402b44f59aca87e62d58efa848e855eba657 100644 --- a/tests/test_messages.py +++ b/tests/test_messages.py @@ -31,7 +31,7 @@ def test_messages_dict_behavior(): from caosdb.common.models import Message, Messages - msgs = _Messages() + msgs = Messages() # create Message msg = Message( @@ -40,10 +40,10 @@ def test_messages_dict_behavior(): description="Greeting the world", body="Hello, world!") - # append it to the _Messages + # append it to the Messages msgs.append(msg) - # use _Messages as list of Message objects + # use Messages as list of Message objects for m in msgs: assert isinstance(m, Message)