Example #1
0
    def test_chmod(self):
        v = hw3.chmod("/dir1", 0o723)
        self.assertEqual(v, 0)

        v, attr = hw3.getattr("/dir1")
        self.assertEqual(v, 0)
        self.assertEqual(attr.st_mode & ~hw3.S_IFMT, 0o723)

        v = hw3.chmod("/file.A", 0o611)
        self.assertEqual(v, 0)

        v, attr = hw3.getattr("/file.A")
        self.assertEqual(v, 0)
        self.assertEqual(attr.st_mode & ~hw3.S_IFMT, 0o611)
 def test_4_chmod(self):
     print "Test 4 - chmod:"
     table = [('/file.B', 0o000755), ('/dir1', 0o000777)]
     for path, mode in table:
         v = hw3.chmod(path, mode)
         self.assertTrue(v == 0)
         v, sb = hw3.getattr(path)
         self.assertTrue(v == 0)
         self.assertEqual((sb.st_mode & ~hw3.S_IFMT), mode)
     self.fsck()
Example #3
0
 def test_36_chmod(self):
     # /dir22/file.10 does not exist
     val = hw3.chmod("/dir2/file.10", 0o100777)
     self.assertEqual(val, -hw3.ENOENT)
Example #4
0
 def test_35_chmod(self):
     # /dir22 does not exist
     val = hw3.chmod("/dir22", 0o40777)
     self.assertEqual(val, -hw3.ENOENT)
Example #5
0
 def test_34_chmod(self):
     val = hw3.chmod("/dir2", 0o40777)
     self.assertEqual(val, 0)
Example #6
0
 def test_32_chmod(self):
     val = hw3.chmod("/dir2", 0o40666)
     self.assertEqual(val, 0)
Example #7
0
 def test_31_chmod(self):
     val = hw3.chmod("/file.10", 0o100666)
     self.assertEqual(val, 0)
Example #8
0
 def test_29_chmod(self):
     val = hw3.chmod("/file.10", 0o100777)
     self.assertEqual(val, 0)