tests: fixing broken tests.
authorFelipe Barriga Richards <spam@felipebarriga.cl>
Thu, 16 Feb 2017 00:55:40 +0000 (21:55 -0300)
committerFelipe Barriga Richards <spam@felipebarriga.cl>
Thu, 16 Feb 2017 00:55:40 +0000 (21:55 -0300)
test/tests.py

index eb425402f4fd9a3302b706f3f4136b52424cb680..48a10f3349cee8f478c4990606a8e07ab46ee26c 100755 (executable)
@@ -22,8 +22,8 @@ import os
 
 class TestXAttrs(unittest.TestCase):
     def setUp(self):
-        self.randomFile = "./mount/tmp/foo.txt"
-        self.randomFileSidecar = "./mount/tmp/foo.txt.xattr"
+        self.randomFile = "./mount/foo.txt"
+        self.randomFileSidecar = "./mount/foo.txt.xattr"
         if os.path.isfile(self.randomFile):
             os.remove(self.randomFile)
         Path(self.randomFile).touch()
@@ -33,6 +33,8 @@ class TestXAttrs(unittest.TestCase):
 
     def tearDown(self):
         os.remove(self.randomFile)
+        if os.path.isfile(self.randomFileSidecar):
+            os.remove(self.randomFileSidecar)
 
     def test_xattr_set(self):
         xattr.setxattr(self.randomFile, "user.foo", bytes("bar", "utf-8"))
@@ -146,9 +148,9 @@ class TestXAttrs(unittest.TestCase):
 
     def test_xattr_list(self):
         enc = "utf-8"
-        key1 = "user.foo"
-        key2 = "user.foo2"
-        key3 = "user.foo3"
+        key1 = b"user.foo"
+        key2 = b"user.foo2"
+        key3 = b"user.foo3"
         value = "bar"
 
         # set 3 keys
@@ -175,7 +177,7 @@ class TestXAttrs(unittest.TestCase):
         # list
         attrs = xattr.listxattr(self.randomFile)
         self.assertEqual(len(attrs), 1)
-        self.assertTrue(key in attrs)
+        self.assertTrue(key.encode() in attrs)
 
         # read
         read_value = xattr.getxattr(self.randomFile, key)