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
8fb25a0d
Commit
8fb25a0d
authored
5 years ago
by
Henrik tom Wörden
Browse files
Options
Downloads
Plain Diff
Merge branch 'f-test_insert_review' into 'f-test_insert_files_in_dir'
F test fixes See merge request caosdb/caosdb-pyinttest!22
parents
decd849a
2690236e
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_file.py
+18
-11
18 additions, 11 deletions
tests/test_file.py
with
18 additions
and
11 deletions
tests/test_file.py
+
18
−
11
View file @
8fb25a0d
...
...
@@ -37,11 +37,12 @@ from nose.tools import (assert_equal, assert_false, # @UnresolvedImport
assert_is_not_none
,
assert_raises
,
assert_true
,
nottest
,
with_setup
)
from
caosdb
import
execute_query
,
get_config
,
get_connection
,
Info
from
caosdb
import
Info
from
caosdb
import
administration
as
admin
from
caosdb
import
execute_query
,
get_config
,
get_connection
from
caosdb.common
import
models
from
caosdb.exceptions
import
EntityError
from
caosdb.utils.checkFileSystemConsistency
import
runCheck
from
caosdb
import
administration
as
admin
def
setup_module
():
...
...
@@ -49,9 +50,8 @@ def setup_module():
def
setup
():
upload_file
=
open
(
"
test.dat
"
,
"
w
"
)
upload_file
.
write
(
"
hello world
\n
"
)
upload_file
.
close
()
with
open
(
"
test.dat
"
,
"
w
"
)
as
upload_file
:
upload_file
.
write
(
"
hello world
\n
"
)
os
.
makedirs
(
"
testfolder/subfolder
"
)
with
open
(
"
testfolder/test1.dat
"
,
"
w
"
)
as
upload_file
:
upload_file
.
write
(
"
hello world
\n
"
)
...
...
@@ -354,6 +354,9 @@ def test_consistency_file_was_modified():
assert_equal
(
c
.
messages
[
"
Info
"
,
0
][
0
],
"
File system is consistent.
"
)
# run consistency check with modified warning)
# TODO fix
# This smells badly. The argument is meant to transport the location
# that is checked. Understanding of the code is difficult.
c
=
runCheck
(
None
,
"
-c FILE_WAS_MODIFIED
"
)
assert_is_not_none
(
c
.
messages
[
"
Error
"
,
0
])
assert_equal
(
...
...
@@ -396,9 +399,8 @@ def test_consistency_file_was_modified():
@with_setup
(
setup
,
teardown
)
def
test_consistency_file_does_not_exist
():
try
:
upload_file
=
open
(
"
test.dat
"
,
"
w
"
)
upload_file
.
write
(
"
hello world
\n
"
)
upload_file
.
close
()
with
open
(
"
test.dat
"
,
"
w
"
)
as
upload_file
:
upload_file
.
write
(
"
hello world
\n
"
)
file_
=
models
.
File
(
name
=
"
TestConsistency1
"
,
description
=
"
Testfile Desc
"
,
path
=
"
debug/test_file_storage_consistency
"
,
...
...
@@ -413,6 +415,9 @@ def test_consistency_file_does_not_exist():
assert_equal
(
c
.
messages
[
"
Info
"
,
0
][
0
],
"
File system below debug/ is consistent.
"
)
# TODO fix
# This smells badly. The argument is meant to transport the location
# that is checked. Understanding of the code is difficult.
c
=
runCheck
(
None
,
"
-c FILE_DOES_NOT_EXIST
"
)
assert_is_not_none
(
c
.
messages
[
"
Error
"
,
0
])
assert_equal
(
...
...
@@ -453,6 +458,9 @@ def test_consistency_unknown_file():
assert_is_not_none
(
c
.
messages
[
"
Info
"
,
0
])
assert_equal
(
c
.
messages
[
"
Info
"
,
0
][
0
],
"
File system is consistent.
"
)
# TODO fix
# This smells badly. The argument is meant to transport the location
# that is checked. Understanding of the code is difficult.
c
=
runCheck
(
None
,
"
-c UNKNOWN_FILE
"
)
assert_is_not_none
(
c
.
messages
[
"
Warning
"
,
0
])
assert_equal
(
c
.
messages
[
"
Warning
"
,
0
][
0
],
'
debug/: Unknown file.
'
)
...
...
@@ -701,10 +709,10 @@ def test_insert_files_in_dir_regex():
"
InsertFilesInDir
"
:
"
-e test
"
+
path_on_server
})
assert
c
.
messages
[
"
Warning
"
,
2
]
is
not
None
assert
c
.
messages
[
"
Warning
"
,
2
][
0
]
==
"
Explicitly excluded directory or file: {}
"
.
format
(
path_on_server
[:
-
1
])
assert
c
.
messages
[
"
Warning
"
,
2
][
0
]
==
"
Explicitly excluded directory or file: {}
"
.
format
(
path_on_server
[:
-
1
])
assert
len
(
c
)
==
0
finally
:
try
:
c
.
delete
()
...
...
@@ -716,7 +724,6 @@ def test_insert_files_in_dir_regex():
pass
@with_setup
(
setup
,
teardown
)
def
test_thumbnails
():
file_
=
models
.
File
(
name
=
"
TestFile
"
,
...
...
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