Skip to content

Commit

Permalink
test_checkIncoming update to guarantee directory state (Closes #17)
Browse files Browse the repository at this point in the history
  • Loading branch information
jtniehof authored and balarsen committed Aug 27, 2020
1 parent 362a0b7 commit 16899b2
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions unit_tests/test_DButils.py
Expand Up @@ -120,14 +120,19 @@ def test_newest_version(self):

def test_checkIncoming(self):
"""checkIncoming"""
self.assertFalse(self.dbu.checkIncoming())
e = self.dbu.getEntry('Mission', 1)
e.incoming_dir = os.path.abspath(os.path.dirname(__file__))
self.dbu.session.add(e)
self.dbu.commitDB()
inc_files = self.dbu.checkIncoming()
self.assertTrue(inc_files)
self.assertTrue(os.path.join(os.path.abspath(os.path.dirname(__file__)), 'test_DButils.py') in inc_files)
td = tempfile.mkdtemp()
try:
e.incoming_dir = td
self.assertFalse(self.dbu.checkIncoming())
fnames = [os.path.join(td, f) for f in ['test', 'test2', '3test']]
for f in fnames:
open(f, 'w').close()
inc_files = self.dbu.checkIncoming()
self.assertTrue(inc_files)
self.assertEqual(sorted(fnames), sorted(inc_files))
finally:
shutil.rmtree(td)

def test_currentlyProcessing(self):
"""currentlyProcessing"""
Expand Down

0 comments on commit 16899b2

Please sign in to comment.