Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
CaosDB Python Integration Tests
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
CaosDB Python Integration Tests
Commits
77fcd0c1
Unverified
Commit
77fcd0c1
authored
5 years ago
by
Daniel
Browse files
Options
Downloads
Patches
Plain Diff
TEST: Test for
caosdb-server#85
parent
dabc1421
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_issues.py
+81
-0
81 additions, 0 deletions
tests/test_issues.py
with
81 additions
and
0 deletions
tests/test_issues.py
0 → 100644
+
81
−
0
View file @
77fcd0c1
# -*- coding: utf-8 -*-
#
# ** header v3.0
# This file is a part of the CaosDB Project.
#
# Copyright (c) 2020 IndiScale GmbH
# Copyright (c) 2020 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/>.
#
# ** end header
"""
Tests for issues on gitlab.com
"""
from
__future__
import
absolute_import
,
print_function
,
unicode_literals
import
caosdb
as
db
from
caosdb.exceptions
import
(
AmbiguityException
,
CaosDBException
,
EntityDoesNotExistError
,
EntityError
,
TransactionError
,
UniqueNamesError
)
from
nose
import
with_setup
from
nose.tools
import
(
assert_equal
,
assert_false
,
assert_is_none
,
assert_is_not_none
,
assert_raises
,
assert_true
,
nottest
)
from
tests
import
test_misc
def
setup_module
():
try
:
db
.
execute_query
(
"
FIND ENTITY WITH ID > 100
"
).
delete
()
except
Exception
as
delete_exc
:
print
(
delete_exc
)
def
setup
():
"""
No setup required.
"""
pass
def
teardown
():
"""
Deleting entities again.
"""
setup_module
()
# ########################### Issue tests start here ###########################
@with_setup
(
setup
,
teardown
)
def
test_issue_85
():
"""
SQLIntegrityConstraintViolationException for special inheritance patterns.
Tests for https://gitlab.com/caosdb/caosdb-server/-/issues/85
"""
A
=
db
.
RecordType
(
name
=
"
A
"
)
B
=
db
.
RecordType
(
name
=
"
B
"
)
C
=
db
.
RecordType
(
name
=
"
C
"
)
B
.
add_parent
(
A
)
# This order is important for the test to fail.
C
.
add_parent
(
B
)
C
.
add_parent
(
C
)
C
.
add_parent
(
A
)
c
=
db
.
Container
()
# c.extend([C, B, A]) # worked before #86 was fixed
# c.extend([C, A, B]) # worked before #86 was fixed
c
.
extend
([
B
,
C
,
A
])
# insert() failed before #86 was fixed
c
.
insert
()
# Raised java.sql.SQLIntegrityConstraintViolationException:
# Duplicate entry '12345-12346-12345' for key 'PRIMARY'
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment