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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
CaosDB Python Integration Tests
Commits
1495fad3
Verified
Commit
1495fad3
authored
Oct 6, 2023
by
Timm Fitschen
Browse files
Options
Downloads
Patches
Plain Diff
TST: Add test for linkahead-server#237
parent
b9859527
No related branches found
No related tags found
No related merge requests found
Pipeline
#42364
failed
Oct 17, 2023
Stage: info
Stage: setup
Stage: cert
Stage: style
Stage: test
Stage: deploy
Changes
3
Pipelines
86
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
tests/test_issues_server.py
+2
-2
2 additions, 2 deletions
tests/test_issues_server.py
tests/test_messages.py
+2
-0
2 additions, 0 deletions
tests/test_messages.py
tests/test_query.py
+40
-0
40 additions, 0 deletions
tests/test_query.py
with
44 additions
and
2 deletions
tests/test_issues_server.py
+
2
−
2
View file @
1495fad3
...
@@ -1444,7 +1444,7 @@ def test_235_long_name():
...
@@ -1444,7 +1444,7 @@ def test_235_long_name():
try
:
try
:
rt1
.
insert
()
rt1
.
insert
()
except
Exception
as
exc
:
except
Exception
as
exc
:
assert
type
(
exc
)
is
not
db
.
HTTPServerError
assert
not
isinstance
(
exc
,
db
.
HTTPServerError
)
# TODO more specific error should be asserted
# TODO more specific error should be asserted
rt2
=
db
.
RecordType
(
name
=
"
Short
"
)
rt2
=
db
.
RecordType
(
name
=
"
Short
"
)
...
@@ -1453,5 +1453,5 @@ def test_235_long_name():
...
@@ -1453,5 +1453,5 @@ def test_235_long_name():
try
:
try
:
rt2
.
update
()
rt2
.
update
()
except
Exception
as
exc
:
except
Exception
as
exc
:
assert
type
(
exc
)
is
not
db
.
HTTPServerError
assert
not
isinstance
(
exc
,
db
.
HTTPServerError
)
# TODO more specific error should be asserted
# TODO more specific error should be asserted
This diff is collapsed.
Click to expand it.
tests/test_messages.py
+
2
−
0
View file @
1495fad3
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
import
caosdb
as
db
import
caosdb
as
db
def
test_messages_dict_behavior
():
def
test_messages_dict_behavior
():
from
caosdb.common.models
import
Message
,
Messages
from
caosdb.common.models
import
Message
,
Messages
...
@@ -71,6 +72,7 @@ def test_messages_dict_behavior():
...
@@ -71,6 +72,7 @@ def test_messages_dict_behavior():
msgs
[
"
HelloWorld
"
]
=
"
Hello!
"
msgs
[
"
HelloWorld
"
]
=
"
Hello!
"
assert
msgs
[
"
HelloWorld
"
]
==
"
Hello!
"
assert
msgs
[
"
HelloWorld
"
]
==
"
Hello!
"
def
test_info
():
def
test_info
():
a
=
str
(
db
.
Info
())
a
=
str
(
db
.
Info
())
assert
a
.
startswith
(
"
Connection to
"
)
assert
a
.
startswith
(
"
Connection to
"
)
This diff is collapsed.
Click to expand it.
tests/test_query.py
+
40
−
0
View file @
1495fad3
...
@@ -1411,3 +1411,43 @@ def test_query_paging():
...
@@ -1411,3 +1411,43 @@ def test_query_paging():
for
entity
in
page
:
for
entity
in
page
:
assert
entity
.
description
is
not
None
assert
entity
.
description
is
not
None
# don't: entity.update()
# don't: entity.update()
def
test_greatest_smallest_id
():
rt1
=
db
.
RecordType
(
"
TestRT1
"
).
insert
()
rt2
=
db
.
RecordType
(
"
TestRT2
"
).
insert
()
# assumptions
assert
rt1
.
id
<
rt2
.
id
# actual testing
assert
db
.
execute_query
(
"
FIND RECORDTYPE Test* WITH ID>99 AND THE SMALLEST ID
"
,
unique
=
True
).
id
==
rt1
.
id
assert
db
.
execute_query
(
"
FIND RECORDTYPE Test* WITH THE GREATEST ID
"
,
unique
=
True
).
id
==
rt2
.
id
assert
db
.
execute_query
(
"
FIND ENTITY Test* WITH THE SMALLEST ID
"
,
unique
=
True
).
id
==
rt1
.
id
assert
db
.
execute_query
(
"
FIND ENTITY Test* WITH THE GREATEST ID
"
,
unique
=
True
).
id
==
rt2
.
id
@mark.xfail
(
reason
=
"
Issue: https://gitlab.com/linkahead/linkahead-server/-/issues/237
"
)
def
test_greatest_smallest_id_over_roles
():
rt1
=
db
.
RecordType
(
"
TestRT1
"
).
insert
()
rt2
=
db
.
RecordType
(
"
TestRT2
"
).
insert
()
p1
=
db
.
Property
(
"
TestProp1
"
,
datatype
=
db
.
TEXT
).
insert
()
p2
=
db
.
Property
(
"
TestProp2
"
,
datatype
=
db
.
TEXT
).
insert
()
# assumptions
assert
rt1
.
id
<
rt2
.
id
assert
rt2
.
id
<
p1
.
id
assert
p1
.
id
<
p2
.
id
# actual testing
assert
db
.
execute_query
(
"
FIND RECORDTYPE WITH THE SMALLEST ID
"
,
unique
=
True
).
id
==
rt1
.
id
assert
db
.
execute_query
(
"
FIND RECORDTYPE WITH THE GREATEST ID
"
,
unique
=
True
).
id
==
rt2
.
id
assert
db
.
execute_query
(
"
FIND PROPERTY WITH THE SMALLEST ID
"
,
unique
=
True
).
id
==
p1
.
id
assert
db
.
execute_query
(
"
FIND PROPERTY WITH THE GREATEST ID
"
,
unique
=
True
).
id
==
p2
.
id
assert
db
.
execute_query
(
"
FIND ENTITY WITH THE SMALLEST ID
"
,
unique
=
True
).
id
==
rt1
.
id
assert
db
.
execute_query
(
"
FIND ENTITY WITH THE GREATEST ID
"
,
unique
=
True
).
id
==
p2
.
id
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