Beispiel #1
0
    def test_get(self):
        m = ops.mode(0o740)

        self.assertTrue(m.user.read)
        self.assertTrue(m.user.write)
        self.assertTrue(m.user.execute)

        self.assertTrue(m.group.read)
        self.assertFalse(m.group.write)
        self.assertFalse(m.group.execute)

        self.assertFalse(m.other.read)
        self.assertFalse(m.other.write)
        self.assertFalse(m.other.execute)
Beispiel #2
0
    def test_set_type(self):
        m = ops.mode()

        m.user = 7
        self.assertTrue(m.user.read)
        self.assertTrue(m.user.write)
        self.assertTrue(m.user.execute)

        m.group = 5
        self.assertTrue(m.group.read)
        self.assertFalse(m.group.write)
        self.assertTrue(m.group.execute)

        m.other = 2
        self.assertFalse(m.other.read)
        self.assertTrue(m.other.write)
        self.assertFalse(m.other.execute)
Beispiel #3
0
    def test_set(self):
        m = ops.mode(0o640)

        m.group.write = True
        m.other.read = True
        self.assertEqual(m.numeric, 0o664)
Beispiel #4
0
    def test_default(self):
        m = ops.mode()

        self.assertEqual(m.user.read, None)
        self.assertEqual(m.group.write, None)
        self.assertEqual(m.other.execute, None)