summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Gallo <aamsgallo@gmail.com>2018-09-04 23:26:05 +0200
committerAlejandro Gallo <aamsgallo@gmail.com>2018-09-04 23:26:05 +0200
commit1e26fee25fb4fe29f83d5fbfe81b34f71bbd701e (patch)
tree8d9909dd3fda9c5180aa5b482121532c9e6e7b6b
parent6443b693ba432822ad2a9a7bc79ca927919b2a0c (diff)
Update addto tests
-rw-r--r--tests/commands/test_addto.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/commands/test_addto.py b/tests/commands/test_addto.py
index 4efaf6d2..ad582202 100644
--- a/tests/commands/test_addto.py
+++ b/tests/commands/test_addto.py
@@ -13,16 +13,16 @@ class Test(unittest.TestCase):
def test_simple_add(self):
db = papis.database.get()
- docs = db.get_all_documents()
+ docs = db.query_dict({'author': 'krishnamurti'})
+ assert(len(docs) == 1)
doc = docs[0]
+
+ # add N files
N = 10
- # add 10 files
- inputfiles = [tempfile.mktemp() for i in range(N)]
- for i in inputfiles:
- open(i, 'w+').close()
- self.assertTrue(len(doc.get_files()) == 1)
+ inputfiles = [tests.create_random_pdf() for i in range(N)]
+
+ old_files = doc.get_files()
+
run(doc, inputfiles)
- self.assertTrue(len(doc.get_files()) == 1+10)
- docs = db.get_all_documents()
- doc = docs[0]
- self.assertTrue(len(doc.get_files()) == 1+10)
+ self.assertTrue(len(doc.get_files()) == len(old_files) + N)
+