Skip to content
Snippets Groups Projects
Commit 7a525917 authored by Daniel's avatar Daniel
Browse files

TEST: Testing file system with empty folder.

parent b50c3e21
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,8 @@
#
# Copyright (C) 2018 Research Group Biomedical Physics,
# Max-Planck-Institute for Dynamics and Self-Organization Göttingen
# Copyright (C) 2019 IndiScale GmbH (info@indiscale.com)
# Copyright (C) 2019 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
......@@ -35,7 +37,7 @@ 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
from caosdb import execute_query, get_config, get_connection, Info
from caosdb.common import models
from caosdb.exceptions import EntityError
from caosdb.utils.checkFileSystemConsistency import runCheck
......@@ -50,13 +52,10 @@ def setup():
upload_file.write("hello world\n")
upload_file.close()
os.mkdir("testfolder")
os.mkdir("testfolder/subfolder")
upload_file = open("testfolder/test1.dat", "w")
upload_file.write("hello world\n")
upload_file.close()
upload_file = open("testfolder/subfolder/test2.dat", "w")
upload_file.write("hello world\n")
upload_file.close()
with open("testfolder/test1.dat", "w") as upload_file:
upload_file.write("hello world\n")
with open("testfolder/subfolder/test2.dat", "w") as upload_file:
upload_file.write("hello world\n")
def teardown():
......@@ -79,7 +78,7 @@ def teardown():
@with_setup(setup, teardown)
def test_file_with_empty_space():
def test_file_with_space():
file_ = models.File(name="TestFile",
description="Testfile Desc",
path="testfiles/test file with spaces.dat",
......@@ -696,3 +695,10 @@ def test_thumbnails():
# TODO find a better way to check this
assert_equal(xml[1][0].get("thumbnail")[-41:],
"/Thumbnails/testfiles/thumbnails_test.dat")
@with_setup(setup, teardown)
def test_empty_folder():
"""The file system has has problems with empty subfolders."""
os.mkdir("testfolder/subfolder")
Info()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment