From f2de61110685f5e8e4ee9f1fac29bbe2c764fece Mon Sep 17 00:00:00 2001 From: Fabien Benureau Date: Thu, 17 Apr 2014 12:52:27 +0200 Subject: [PATCH] fixed last regression test --- tests/.gitignore | 1 - tests/test_filebroker.py | 30 +++++++++++++++--------------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/tests/.gitignore b/tests/.gitignore index 77eb33e..751553b 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -1,2 +1 @@ -tmpdir* *.bak diff --git a/tests/test_filebroker.py b/tests/test_filebroker.py index 67c8b20..53a1f23 100644 --- a/tests/test_filebroker.py +++ b/tests/test_filebroker.py @@ -26,21 +26,21 @@ class TestFileBroker(fake_env.TestFakeFs): def test_existing_data(self): - fake_env.copy_dir(self.fs, os.path.join(os.path.dirname(__file__), 'tmpdir'), 'tmpdir') - fb = filebroker.FileBroker('tmpdir', create = True) + fake_env.copy_dir(self.fs, os.path.join(os.path.dirname(__file__), 'testrepo'), 'testrepo') + fb = filebroker.FileBroker('testrepo', create = True) - with open('tmpdir/bib/Page99.bib', 'r') as f: + with open('testrepo/bib/Page99.bib', 'r') as f: self.assertEqual(fb.pull_bibfile('Page99'), f.read()) - with open('tmpdir/meta/Page99.yaml', 'r') as f: + with open('testrepo/meta/Page99.yaml', 'r') as f: self.assertEqual(fb.pull_metafile('Page99'), f.read()) def test_errors(self): with self.assertRaises(IOError): - filebroker.FileBroker('tmpdir', create = False) + filebroker.FileBroker('testrepo', create = False) - fb = filebroker.FileBroker('tmpdir', create = True) + fb = filebroker.FileBroker('testrepo', create = True) with self.assertRaises(IOError): fb.pull_bibfile('Page99') with self.assertRaises(IOError): @@ -49,9 +49,9 @@ class TestFileBroker(fake_env.TestFakeFs): def test_errors(self): with self.assertRaises(IOError): - filebroker.FileBroker('tmpdir', create = False) + filebroker.FileBroker('testrepo', create = False) - fb = filebroker.FileBroker('tmpdir', create = True) + fb = filebroker.FileBroker('testrepo', create = True) self.assertFalse(fb.exists('Page99')) with self.assertRaises(IOError): @@ -62,9 +62,9 @@ class TestFileBroker(fake_env.TestFakeFs): def test_remove(self): with self.assertRaises(IOError): - filebroker.FileBroker('tmpdir', create = False) + filebroker.FileBroker('testrepo', create = False) - fb = filebroker.FileBroker('tmpdir', create = True) + fb = filebroker.FileBroker('testrepo', create = True) fb.push_bibfile('citekey1', 'abc') self.assertEqual(fb.pull_bibfile('citekey1'), 'abc') @@ -86,19 +86,19 @@ class TestDocBroker(fake_env.TestFakeFs): fake_env.copy_dir(self.fs, os.path.join(os.path.dirname(__file__), 'data'), 'data') - fb = filebroker.FileBroker('tmpdir', create = True) - docb = filebroker.DocBroker('tmpdir') + fb = filebroker.FileBroker('testrepo', create = True) + docb = filebroker.DocBroker('testrepo') docpath = docb.add_doc('Page99', 'data/pagerank.pdf') - self.assertTrue(content.check_file(os.path.join('tmpdir', 'doc/Page99.pdf'))) + self.assertTrue(content.check_file(os.path.join('testrepo', 'doc/Page99.pdf'))) self.assertTrue(docb.in_docsdir(docpath)) self.assertEqual(docpath, 'docsdir://Page99.pdf') docb.remove_doc('docsdir://Page99.pdf') - self.assertFalse(content.check_file(os.path.join('tmpdir', 'doc/Page99.pdf'), fail=False)) + self.assertFalse(content.check_file(os.path.join('testrepo', 'doc/Page99.pdf'), fail=False)) with self.assertRaises(IOError): - self.assertFalse(content.check_file(os.path.join('tmpdir', 'doc/Page99.pdf'), fail=True)) + self.assertFalse(content.check_file(os.path.join('testrepo', 'doc/Page99.pdf'), fail=True)) if __name__ == '__main__':