Skip to content
Snippets Groups Projects
Commit f970d1e2 authored by Florian Spreckelsen's avatar Florian Spreckelsen
Browse files

Server 62 renaming

parent e9315408
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added (for new features)
- Tests for [#62](https://gitlab.com/caosdb/caosdb-server/-/issues/62)
in caosdb-server-project, i.e., renaming of a RecordType that should
be reflected in properties with that RT as datatype.
### Changed (for changes in existing functionality)
### Deprecated (for soon-to-be removed features)
......
......@@ -3,8 +3,9 @@
# ** header v3.0
# This file is a part of the CaosDB Project.
#
# Copyright (c) 2020 IndiScale GmbH (www.indiscale.com)
# Copyright (c) 2020 Daniel Hornung (d.hornung@indiscale.com)
# Copyright (c) 2020 IndiScale GmbH <info@indiscale.com>
# Copyright (c) 2020 Daniel Hornung <d.hornung@indiscale.com>
# Copyright (c) 2020 Florian Spreckelsen <f.spreckelsen@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
......@@ -21,9 +22,11 @@
#
# ** end header
"""Tests for issues on gitlab.com, project caosdb-mysqlbackend."""
"""Tests for issues on gitlab.com, project caosdb-server."""
import caosdb as db
from caosdb.exceptions import EntityError
import pytest
def setup_module():
......@@ -45,6 +48,31 @@ def teardown():
# ########################### Issue tests start here ###########################
@pytest.mark.xfail(reason="to be fixed in server repo")
def test_issue_62():
"""datatype is not changed when recordtype name changes
Tests for https://gitlab.com/caosdb/caosdb-server/-/issues/62
"""
db.RecordType(name="Test_RTA").insert()
db.Property(name="Test_Prop", datatype="Test_RTA").insert()
db.Record(name="Test_Record").add_parent(
name="Test_RTA").add_property(name="Test_Prop").insert()
# rename Test_RTA to Test_RTB
rtb = db.execute_query("FIND RecordType Test_RTA", unique=True)
rtb.name = "Test_RTB"
rtb.update()
# renaming has to be reflected in Test_Record and Test_Prop
rec = db.execute_query("FIND Record Test_Record", unique=True)
assert rec.parents[0].name == rtb.name
prop = db.execute_query("FIND Property Test_Prop", unique=True)
assert prop.datatype == rtb.name # fails; datatype not updated
# Can't use Test_RTA as datatype anymore
prop2 = db.Property(name="Test_Prop2", datatype="Test_RTA")
with pytest.raises(EntityError):
prop2.insert()
def test_issue_85_a():
"""SQLIntegrityConstraintViolationException for special inheritance patterns.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment