diff --git a/tests/test_issues_server.py b/tests/test_issues_server.py index 763009c10acfcd6ce483bcdc24336140cc90dc65..8b73d5e1890daba945e5c20008d9d4157d4b1dee 100644 --- a/tests/test_issues_server.py +++ b/tests/test_issues_server.py @@ -30,7 +30,11 @@ import linkahead as db import pytest from linkahead import administration as admin -from linkahead.exceptions import (TransactionError, HTTPClientError, HTTPURITooLongError) +from linkahead.exceptions import ( + TransactionError, + HTTPClientError, + HTTPURITooLongError, +) CURATOR_ROLE = "curator" @@ -1508,6 +1512,25 @@ def test_253(): assert len(results) == 0 +@pytest.mark.xfail(reason="https://gitlab.com/linkahead/linkahead-server/-/issues/258") +def test_258_name_too_long(): + """Unexpected server error when name is too long.""" + test_name_short = [ + "0123456789", + "0123456789" * 25, + ] + test_name_long = [ + "0123456789" * 26, + ] + for name in test_name_short: + ent = db.RecordType(name=name).insert() + assert ent.id > 0 + for name in test_name_long: + with pytest.raises(TransactionError) as tre: + db.RecordType(name=name).insert() + assert "too long" in str(tre.value) + + @pytest.mark.xfail(reason="https://gitlab.com/linkahead/linkahead-server/-/issues/260") def test_260_datetime_without_date(): """Only time value in datetime property must not cause an unexpected server