-
Notifications
You must be signed in to change notification settings - Fork 9
/
tests.py
35 lines (25 loc) · 922 Bytes
/
tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import unittest
import os
from macster import macster
import shutil
class MacsterTests(unittest.TestCase):
TEST_DIRECTORY = '/tmp/macster/'
TEST_SUBDIRS = []
def setUp(self):
if not os.path.exists(self.TEST_DIRECTORY):
os.makedirs(self.TEST_DIRECTORY)
sub_dir_names = ["a", "b", "c", "d/e"]
for sub_dir in sub_dir_names:
sub_dirs = os.path.join(self.TEST_DIRECTORY, sub_dir)
self.TEST_SUBDIRS.append(sub_dirs)
os.makedirs(sub_dirs)
def test_macster(self):
macster(self.TEST_DIRECTORY)
all_dirs = [self.TEST_DIRECTORY, ] + self.TEST_SUBDIRS
for dir_ in all_dirs:
dsstore_file = os.path.join(dir_, '.DS_Store')
self.assertEqual(os.path.exists(dsstore_file), True)
def tearDown(self):
shutil.rmtree(self.TEST_DIRECTORY)
if __name__ == '__main__':
unittest.main()