summaryrefslogtreecommitdiff
path: root/clitest.py
diff options
context:
space:
mode:
authorjvoisin2011-06-10 01:29:29 +0200
committerjvoisin2011-06-10 01:29:29 +0200
commitc308cf7daaa4fa46377e2df0f2e9a397981e19b2 (patch)
treef016ce17cd6747acc068a7d2fc5093d1bd96fa9e /clitest.py
parentf7082a21d6511c5069fbb9ff186ce22f3e22fed7 (diff)
The current version is (mostly) working
Diffstat (limited to '')
-rw-r--r--clitest.py (renamed from lib/test.py)40
1 files changed, 12 insertions, 28 deletions
diff --git a/lib/test.py b/clitest.py
index b1ff2a3..00955ae 100644
--- a/lib/test.py
+++ b/clitest.py
@@ -1,45 +1,29 @@
1import mat 1import cli
2import unittest 2import unittest
3import shutil 3import test
4import glob
5import tempfile
6 4
7FILE_LIST = zip(glob.glob('clean*'), glob.glob('dirty*')) 5import shlex
6import subprocess
8 7
9class MATTest(unittest.TestCase): 8class Test_Remove_cli(test.MATTest):
10 def setUp(self):
11 '''create working copy of the clean and the dirty file in the TMP dir'''
12 self.file_list = []
13 self.tmpdir = tempfile.mkdtemp()
14
15 for clean, dirty in FILE_LIST:
16 shutil.copy2(clean, self.tmpdir + clean)
17 shutil.copy2(dirty, self.tmpdir + dirty)
18 self.file_list.append((self.tmpdir + clean, self.tmpdir + dirty))
19
20 def tearDown(self):
21 '''Remove the tmp folder'''
22 shutil.rmtree(self.tmpdir)
23
24class Test_Remove(MATTest):
25 def test_remove(self): 9 def test_remove(self):
26 '''make sure that the lib remove all compromizing meta''' 10 '''make sure that the cli remove all compromizing meta'''
27 for clean, dirty in self.file_list: 11 for clean, dirty in self.file_list:
28 mat.file(dirty).remove_all() 12 subprocess.call("cli.py %s" dirty)
29 self.assertTrue(mat.file(dirty).is_clean()) 13 self.assertTrue(mat.file(dirty).is_clean())
30 14
31 def test_remove_empty(self): 15 def test_remove_empty(self):
32 '''Test removal with clean files''' 16 '''Test removal with clean files'''
33 for clean, dirty in self.file_list: 17 for clean, dirty in self.file_list:
34 mat.file(clean).remove_all() 18 subprocess.call("cli.py %s" clean)
35 self.assertTrue(mat.file(clean).is_clean()) 19 self.assertTrue(mat.file(dirty).is_clean())
36 20
37 21
38class Test_List(MATTest): 22class Test_List_cli(test.MATTest):
39 def test_list(self): 23 def test_list(self):
40 '''check if get_meta returns all the expected meta''' 24 '''check if get_meta returns all the expected meta'''
41 for clean, dirty in self.file_list: 25 for clean, dirty in self.file_list:
42 meta_list = dict() #FIXME 26 meta_list = dict("fixme":"please",) #FIXME
43 self.assertDictEqual(mat.file(dirty).get_meta(), meta_list) 27 self.assertDictEqual(mat.file(dirty).get_meta(), meta_list)
44 28
45 def testlist_list_empty(self): 29 def testlist_list_empty(self):
@@ -48,7 +32,7 @@ class Test_List(MATTest):
48 self.assertEqual(mat.file(clean).get_meta(), None) 32 self.assertEqual(mat.file(clean).get_meta(), None)
49 33
50 34
51class Test_isClean(MATTest): 35class Test_isClean_cli(test.MATTest):
52 def test_clean(self): 36 def test_clean(self):
53 '''test is_clean on clean files''' 37 '''test is_clean on clean files'''
54 for clean, dirty in self.file_list: 38 for clean, dirty in self.file_list: