diff --git a/tests/test_issues_pylib.py b/tests/test_issues_pylib.py new file mode 100644 index 0000000000000000000000000000000000000000..fdf76c99e055a282ce0ab6b3d1d1210165bb15ee --- /dev/null +++ b/tests/test_issues_pylib.py @@ -0,0 +1,81 @@ +# -*- coding: utf-8 -*- +# This file is a part of the LinkAhead Project. +# +# Copyright (c) 2023 IndiScale GmbH <info@indiscale.com> +# Copyright (c) 2023 Daniel Hornung <d.hornung@indiscale.com> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + +"""Tests for issues on gitlab.com, project linkahead-pylib. + +Tests should be named: + + ``test_gitlab_com_{issue_id}`` +""" + +import math +import os +import tempfile +import time + +import linkahead as db +import pytest + +from linkahead import administration as admin +from linkahead.exceptions import (TransactionError, HTTPClientError) + +CURATOR_ROLE = "curator" + + +def setup_module(): + db.configure_connection() + try: + db.execute_query("FIND ENTITY WITH ID > 99").delete() + except Exception as delete_exc: + print(delete_exc) + try: + admin._delete_user("TestUser") + except Exception as delete_exc: + print(delete_exc) + try: + admin._delete_role(CURATOR_ROLE) + except Exception as delete_exc: + print(delete_exc) + + +def setup_function(function): + """No setup required.""" + setup_module() + + +def teardown_function(function): + """Deleting entities again.""" + setup_module() + + +# ########################### Issue tests start here ##################### + + +@pytest.mark.xfail(reason="Entities with many, long, properties: " + "https://gitlab.com/linkahead/linkahead-pylib/-/issues/108") +def test_gitlab_com_108(self): + # create RT and one property + cont = db.Container() + long = "Long" * 50 + first_RT = db.RecordType(name=f"TestRecord_first") + for index in range(20): + this_RT = db.RecordType(name=f"TestRecord_{long}_{index:02d}") + first_RT.add_property(this_RT) + cont.append(first_RT) + cont.retrieve()