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
d3872d18
Commit
d3872d18
authored
1 year ago
by
Florian Spreckelsen
Browse files
Options
Downloads
Plain Diff
Merge branch 'f-filesystem-response-url' into 'dev'
TST: filestem response url See merge request
!64
parents
23922244
4b73d0de
No related branches found
No related tags found
1 merge request
!64
TST: filestem response url
Pipeline
#40110
passed
1 year ago
Stage: info
Stage: setup
Stage: cert
Stage: style
Stage: test
Stage: deploy
Changes
2
Pipelines
58
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/test_misc.py
+21
-0
21 additions, 0 deletions
tests/test_misc.py
tests/test_tenpoints.py
+436
-550
436 additions, 550 deletions
tests/test_tenpoints.py
with
457 additions
and
550 deletions
tests/test_misc.py
+
21
−
0
View file @
d3872d18
...
@@ -60,6 +60,27 @@ def test_file_system_returns_ids(clear_database):
...
@@ -60,6 +60,27 @@ def test_file_system_returns_ids(clear_database):
assert
search
in
str
(
body
)
assert
search
in
str
(
body
)
def
test_file_system_returns_correct_url_with_proxy
(
clear_database
):
c
=
db
.
get_connection
()
resp
=
c
.
retrieve
(
entity_uri_segments
=
[
"
FileSystem
"
],
headers
=
{
"
X-Forwarded-Proto
"
:
"
myscheme
"
},
reconnect
=
True
)
body
=
resp
.
read
()
print
(
body
)
search
=
'
url=
"
myscheme://
'
assert
search
in
str
(
body
)
resp
=
c
.
retrieve
(
entity_uri_segments
=
[
"
FileSystem
"
],
headers
=
{
"
Forwarded
"
:
"
by=byid;for=forid;host=hostaddress;proto=myother
"
},
reconnect
=
True
)
body
=
resp
.
read
()
print
(
body
)
search
=
'
url=
"
myother://
'
assert
search
in
str
(
body
)
def
test_sat_query_with_leading_slash
(
clear_database
):
def
test_sat_query_with_leading_slash
(
clear_database
):
upload_file
=
open
(
"
test.dat
"
,
"
w
"
)
upload_file
=
open
(
"
test.dat
"
,
"
w
"
)
upload_file
.
write
(
"
hello world
\n
"
)
upload_file
.
write
(
"
hello world
\n
"
)
...
...
This diff is collapsed.
Click to expand it.
tests/test_tenpoints.py
+
436
−
550
View file @
d3872d18
...
@@ -25,7 +25,6 @@
...
@@ -25,7 +25,6 @@
@author: fitschen
@author: fitschen
"""
"""
from
nose.tools
import
assert_equal
,
assert_is_not_none
,
assert_true
# @UnresolvedImport
import
caosdb
as
h
import
caosdb
as
h
import
os
import
os
from
caosdb.exceptions
import
CaosDBException
from
caosdb.exceptions
import
CaosDBException
...
@@ -52,23 +51,15 @@ Datensätzen
...
@@ -52,23 +51,15 @@ Datensätzen
Description oder einer Zahl
'''
Description oder einer Zahl
'''
def
setup_
module
(
):
def
setup_
function
(
function
):
try
:
try
:
h
.
execute_query
(
"
FIND Complex*
"
).
delete
()
h
.
execute_query
(
"
FIND ENTITY *
"
).
delete
()
except
Exception
as
e
:
print
(
e
)
try
:
h
.
execute_query
(
"
FIND ReferenceProperty
"
).
delete
()
except
Exception
as
e
:
print
(
e
)
try
:
h
.
execute_query
(
"
FIND Simple*
"
).
delete
()
except
Exception
as
e
:
except
Exception
as
e
:
print
(
e
)
print
(
e
)
def
teardown_
module
(
):
def
teardown_
function
(
function
):
setup_
module
(
)
setup_
function
(
function
)
def
test_tenpoints1_1
():
def
test_tenpoints1_1
():
...
@@ -77,7 +68,6 @@ def test_tenpoints1_1():
...
@@ -77,7 +68,6 @@ def test_tenpoints1_1():
enthalten (Gewicht, Beschreibung, Identifkationsnummern, etc.)
enthalten (Gewicht, Beschreibung, Identifkationsnummern, etc.)
'''
'''
try
:
c
=
h
.
Container
()
c
=
h
.
Container
()
c
.
append
(
c
.
append
(
h
.
Property
(
h
.
Property
(
...
@@ -110,18 +100,12 @@ def test_tenpoints1_1():
...
@@ -110,18 +100,12 @@ def test_tenpoints1_1():
name
=
'
SimpleDatetimeProperty
'
))
name
=
'
SimpleDatetimeProperty
'
))
c
.
insert
()
c
.
insert
()
finally
:
try
:
c
.
delete
()
except
BaseException
:
pass
def
test_tenpoints1_2
():
def
test_tenpoints1_2
():
'''
'''
1.2 Einfügen von RecordTypes, die zusätzlich Dateien referenzieren
1.2 Einfügen von RecordTypes, die zusätzlich Dateien referenzieren
'''
'''
try
:
c
=
h
.
Container
()
c
=
h
.
Container
()
c
.
append
(
c
.
append
(
h
.
Property
(
h
.
Property
(
...
@@ -160,11 +144,6 @@ def test_tenpoints1_2():
...
@@ -160,11 +144,6 @@ def test_tenpoints1_2():
name
=
'
SimpleFileProperty
'
))
name
=
'
SimpleFileProperty
'
))
c
.
insert
()
c
.
insert
()
finally
:
try
:
c
.
delete
()
except
BaseException
:
pass
def
test_tenpoints1_3
():
def
test_tenpoints1_3
():
...
@@ -173,7 +152,6 @@ def test_tenpoints1_3():
...
@@ -173,7 +152,6 @@ def test_tenpoints1_3():
andere RecordTypes enthalten
andere RecordTypes enthalten
'''
'''
try
:
c
=
h
.
Container
()
c
=
h
.
Container
()
c
.
append
(
c
.
append
(
h
.
Property
(
h
.
Property
(
...
@@ -223,11 +201,6 @@ def test_tenpoints1_3():
...
@@ -223,11 +201,6 @@ def test_tenpoints1_3():
)
)
c
.
insert
()
c
.
insert
()
finally
:
try
:
c
.
delete
()
except
BaseException
:
pass
def
test_tenpoints1_4
():
def
test_tenpoints1_4
():
...
@@ -245,7 +218,6 @@ def test_tenpoints1_5():
...
@@ -245,7 +218,6 @@ def test_tenpoints1_5():
RecordTypes / Properties
RecordTypes / Properties
'''
'''
try
:
c
=
h
.
Container
()
c
=
h
.
Container
()
c
.
append
(
c
.
append
(
h
.
Property
(
h
.
Property
(
...
@@ -316,28 +288,6 @@ def test_tenpoints1_5():
...
@@ -316,28 +288,6 @@ def test_tenpoints1_5():
cr2
.
insert
()
cr2
.
insert
()
finally
:
try
:
cr2
.
delete
()
except
BaseException
:
pass
try
:
cr1
.
delete
()
except
BaseException
:
pass
try
:
sr
.
delete
()
except
BaseException
:
pass
try
:
d
.
delete
()
except
BaseException
:
pass
try
:
c
.
delete
()
except
BaseException
:
pass
def
test_tenpoints2_1AND2_2
():
def
test_tenpoints2_1AND2_2
():
'''
'''
...
@@ -346,7 +296,6 @@ def test_tenpoints2_1AND2_2():
...
@@ -346,7 +296,6 @@ def test_tenpoints2_1AND2_2():
Datensätzen
Datensätzen
'''
'''
try
:
"""
data model.
"""
"""
data model.
"""
c
=
h
.
Container
()
c
=
h
.
Container
()
c
.
append
(
c
.
append
(
...
@@ -446,34 +395,20 @@ def test_tenpoints2_1AND2_2():
...
@@ -446,34 +395,20 @@ def test_tenpoints2_1AND2_2():
d
.
insert
()
d
.
insert
()
e
=
d
.
get_entity_by_name
(
"
SimpleRecord
"
)
e
=
d
.
get_entity_by_name
(
"
SimpleRecord
"
)
assert
_
is
_
not
_n
one
(
e
)
assert
e
is
not
N
one
assert
_true
(
e
.
is_valid
()
)
assert
e
.
is_valid
()
fp
=
e
.
get_property
(
"
SimpleFileProperty
"
)
fp
=
e
.
get_property
(
"
SimpleFileProperty
"
)
assert
_
is
_
not
_n
one
(
fp
)
assert
fp
is
not
N
one
assert
_
is
_
not
_n
one
(
fp
.
value
)
assert
fp
.
value
is
not
N
one
fr
=
d
.
get_entity_by_name
(
"
SimpleFileRecord
"
)
fr
=
d
.
get_entity_by_name
(
"
SimpleFileRecord
"
)
assert
_
is
_
not
_n
one
(
fr
)
assert
fr
is
not
N
one
assert
_true
(
fr
.
is_valid
()
)
assert
fr
.
is_valid
()
assert
_
is
_
not
_n
one
(
fr
.
id
)
assert
fr
.
id
is
not
N
one
assert
_equal
(
int
(
fp
.
value
)
,
fr
.
id
)
assert
int
(
fp
.
value
)
==
fr
.
id
print
(
d
)
print
(
d
)
finally
:
try
:
d
.
delete
()
except
BaseException
:
pass
try
:
c
.
delete
()
except
BaseException
:
pass
try
:
os
.
remove
(
"
test.dat
"
)
except
BaseException
:
pass
try
:
"""
insert file via dropOffBox.
"""
"""
insert file via dropOffBox.
"""
dob
=
h
.
DropOffBox
().
sync
()
dob
=
h
.
DropOffBox
().
sync
()
if
os
.
path
.
isdir
(
dob
.
path
):
if
os
.
path
.
isdir
(
dob
.
path
):
...
@@ -483,17 +418,11 @@ def test_tenpoints2_1AND2_2():
...
@@ -483,17 +418,11 @@ def test_tenpoints2_1AND2_2():
import
shutil
import
shutil
shutil
.
move
(
"
test.dat
"
,
dob
.
path
)
shutil
.
move
(
"
test.dat
"
,
dob
.
path
)
fo
=
h
.
File
(
path
=
'
testfiles/testfile2
'
,
pickup
=
"
test.dat
"
).
insert
()
fo
=
h
.
File
(
path
=
'
testfiles/testfile2
'
,
pickup
=
"
test.dat
"
).
insert
()
finally
:
try
:
fo
.
delete
()
except
BaseException
:
pass
def
test_tenpoints2_3
():
def
test_tenpoints2_3
():
'''
2.3 Verwendung von Einheiten
'''
'''
2.3 Verwendung von Einheiten
'''
try
:
"""
insert simple property with unit.
"""
"""
insert simple property with unit.
"""
p1
=
h
.
Property
(
name
=
'
unittestproperty
'
,
datatype
=
'
double
'
,
unit
=
'
m
'
)
p1
=
h
.
Property
(
name
=
'
unittestproperty
'
,
datatype
=
'
double
'
,
unit
=
'
m
'
)
p1
.
insert
()
p1
.
insert
()
...
@@ -501,7 +430,7 @@ def test_tenpoints2_3():
...
@@ -501,7 +430,7 @@ def test_tenpoints2_3():
'''
subtyping with unit inheritance
'''
'''
subtyping with unit inheritance
'''
p2
=
h
.
Property
(
name
=
'
SubTypeOfUnitTestProperty
'
).
add_parent
(
id
=
p1
.
id
)
p2
=
h
.
Property
(
name
=
'
SubTypeOfUnitTestProperty
'
).
add_parent
(
id
=
p1
.
id
)
p2
.
insert
()
p2
.
insert
()
assert
_equal
(
'
m
'
,
p2
.
unit
)
assert
'
m
'
==
p2
.
unit
'''
implement property
'''
'''
implement property
'''
rt
=
h
.
RecordType
(
rt
=
h
.
RecordType
(
...
@@ -513,29 +442,15 @@ def test_tenpoints2_3():
...
@@ -513,29 +442,15 @@ def test_tenpoints2_3():
rtid
=
rt
.
id
rtid
=
rt
.
id
rt
=
h
.
RecordType
(
id
=
rtid
).
retrieve
()
rt
=
h
.
RecordType
(
id
=
rtid
).
retrieve
()
print
(
rt
)
print
(
rt
)
assert
_equal
(
p2
.
id
,
rt
.
get_properties
()[
0
].
id
)
assert
p2
.
id
==
rt
.
get_properties
()[
0
].
id
assert_equal
(
'
m
'
,
rt
.
get_properties
()[
0
].
unit
)
assert
'
m
'
==
rt
.
get_properties
()[
0
].
unit
finally
:
try
:
rt
.
delete
()
except
BaseException
:
pass
try
:
p2
.
delete
()
except
BaseException
:
pass
try
:
p1
.
delete
()
except
BaseException
:
pass
def
test_tenpoints2_4
():
def
test_tenpoints2_4
():
'''
2.4 Nachtägliches Annotieren von Datensätzen, z.B. hinzufügen einer
'''
2.4 Nachtägliches Annotieren von Datensätzen, z.B. hinzufügen einer
Description oder einer Zahl
'''
Description oder einer Zahl
'''
try
:
c
=
h
.
Container
()
c
=
h
.
Container
()
c
.
append
(
c
.
append
(
h
.
Property
(
h
.
Property
(
...
@@ -650,28 +565,6 @@ def test_tenpoints2_4():
...
@@ -650,28 +565,6 @@ def test_tenpoints2_4():
c
.
get_entity_by_name
(
"
CommentProperty
"
),
c
.
get_entity_by_name
(
"
CommentProperty
"
),
value
=
"
I looove this record!!!!!11.
"
).
update
()
value
=
"
I looove this record!!!!!11.
"
).
update
()
finally
:
try
:
cr2
.
delete
()
except
BaseException
:
pass
try
:
cr1
.
delete
()
except
BaseException
:
pass
try
:
e
.
delete
()
except
BaseException
:
pass
try
:
d
.
delete
()
except
BaseException
:
pass
try
:
c
.
delete
()
except
BaseException
:
pass
def
test_existence
():
def
test_existence
():
...
@@ -693,10 +586,3 @@ def test_existence():
...
@@ -693,10 +586,3 @@ def test_existence():
print
(
"
SimpleTextProperty does exist!
"
)
print
(
"
SimpleTextProperty does exist!
"
)
p
.
delete
()
p
.
delete
()
def
test_cleanup
():
try
:
h
.
execute_query
(
"
FIND Simple*
"
).
delete
()
except
BaseException
:
pass
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