summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRadek Podgorny <radek@podgorny.cz>2015-06-11 21:19:55 +0200
committerRadek Podgorny <radek@podgorny.cz>2015-06-11 21:19:55 +0200
commit7a9b96e7ce1a068881c997eb39728a1eb47d4ba9 (patch)
tree3d3ff7cd6e3a5a673db0b6b4aade2721d124ca22
parent4167fbe614f0b5c7662c4201c07a9432264e0838 (diff)
parentdb60b5290b9490758da1954c842eb048fb427a01 (diff)
downloadunionfs-fuse-git-7a9b96e7ce1a068881c997eb39728a1eb47d4ba9.tar.gz
Merge pull request #20 from evnu/add-tests
Add simple write tests
-rwxr-xr-xtest.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/test.py b/test.py
index d900190..d27bd53 100755
--- a/test.py
+++ b/test.py
@@ -138,6 +138,10 @@ class UnionFS_RW_RO_TestCase(Common, unittest.TestCase):
with self.assertRaises(PermissionError):
write_to_file('union/ro1_file', 'something')
#endwith
+ write_to_file('union/new_file', 'something')
+ self.assertEqual(read_from_file('union/new_file'), 'something')
+ self.assertEqual(read_from_file('rw1/new_file'), 'something')
+ self.assertNotIn('new_file', os.listdir('ro1'))
#enddef
#endclass
@@ -175,6 +179,14 @@ class UnionFS_RW_RO_COW_TestCase(Common, unittest.TestCase):
self.assertFalse(os.path.isfile('union/ro_file'))
self.assertFalse(os.path.isfile('rw1/ro_file'))
self.assertEqual(read_from_file('ro1/ro1_file'), 'ro1')
+ self.assertNotIn('new_file', os.listdir('ro1'))
+ #enddef
+ def test_write(self):
+ write_to_file('union/new_file', 'something')
+ self.assertEqual(read_from_file('union/new_file'), 'something')
+ self.assertEqual(read_from_file('rw1/new_file'), 'something')
+ self.assertEqual(read_from_file('ro1/ro1_file'), 'ro1')
+ self.assertNotIn('new_file', os.listdir('ro1'))
#enddef
#endclass
@@ -202,6 +214,10 @@ class UnionFS_RO_RW_TestCase(Common, unittest.TestCase):
with self.assertRaises(PermissionError):
write_to_file('union/ro1_file', 'something')
#endwith
+ with self.assertRaises(PermissionError):
+ write_to_file('union/new_file', 'something')
+ self.assertNotIn('new_file', os.listdir('ro1'))
+ self.assertNotIn('new_file', os.listdir('rw1'))
#enddef
#endclass
@@ -228,6 +244,10 @@ class UnionFS_RO_RW_COW_TestCase(Common, unittest.TestCase):
with self.assertRaises(PermissionError):
write_to_file('union/ro1_file', 'something')
#endwith
+ write_to_file('union/new_file', 'something')
+ self.assertIn('new_file', os.listdir('rw1'))
+ self.assertEqual(read_from_file('rw1/new_file'), 'something')
+ self.assertNotIn('new_file', os.listdir('ro1'))
#enddef
#endclass