Ejemplo n.º 1
0
    def testBasicDir(self):
        """Test reading and writing of ACL w/ defaults to directory"""
        self.make_temp_out_dirs()
        new_acl = AccessControlLists(())
        new_acl.read_from_rp(tempdir)
        assert new_acl.is_basic()
        assert new_acl != self.dir_acl

        self.dir_acl.write_to_rp(tempdir)
        new_acl.read_from_rp(tempdir)
        assert not new_acl.is_basic()
        if not new_acl == self.dir_acl:
            assert new_acl.eq_verbose(self.dir_acl)
            assert 0, "Shouldn't be here---eq != eq_verbose?"
Ejemplo n.º 2
0
    def testBasicDir(self):
        """Test reading and writing of ACL w/ defaults to directory"""
        self.make_temp_out_dirs()
        new_acl = AccessControlLists(())
        new_acl.read_from_rp(tempdir)
        self.assertTrue(new_acl.is_basic())
        self.assertNotEqual(new_acl, self.dir_acl)

        self.dir_acl.write_to_rp(tempdir)
        new_acl.read_from_rp(tempdir)
        self.assertFalse(new_acl.is_basic())
        if not new_acl == self.dir_acl:
            self.assertTrue(new_acl._eq_verbose(self.dir_acl))
            self.assertFalse("Shouldn't be here---eq != _eq_verbose?")
Ejemplo n.º 3
0
    def test_acl_dropping(self):
        """Test dropping of ACL names"""
        self.make_temp_out_dirs()
        rp = tempdir.append('a1')
        rp.touch()
        """ben uses a dvorak keyboard, and these sequences are
        analogous to asdfsjkd for a qwerty user... these
        users and groups are not expected to exist. -dean"""
        acl = AccessControlLists(('a1', ), """user::rwx
user:aoensutheu:r--
group::r-x
group:aeuai:r-x
group:enutohnh:-w-
other::---""")
        rp.write_acl(acl)
        rp2 = tempdir.append('a1')
        acl2 = AccessControlLists(('a1', ))
        acl2.read_from_rp(rp2)
        assert acl2.is_basic()
        Globals.never_drop_acls = 1
        try:
            rp.write_acl(acl)
        except SystemExit:
            pass
        else:
            assert 0, "Above should have exited with fatal error"
        Globals.never_drop_acls = None
Ejemplo n.º 4
0
    def testBasic(self):
        """Test basic writing and reading of ACLs"""
        self.make_temp_out_dirs()
        new_acl = AccessControlLists(())
        tempdir.chmod(0o700)
        new_acl.read_from_rp(tempdir)
        self.assertTrue(new_acl.is_basic())
        self.assertNotEqual(new_acl, self.sample_acl)
        self.assertEqual(new_acl, self.empty_acl)

        self.sample_acl.write_to_rp(tempdir)
        new_acl.read_from_rp(tempdir)
        self.assertEqual(str(new_acl), str(self.sample_acl))
        self.assertEqual(new_acl, self.sample_acl)
Ejemplo n.º 5
0
    def testBasic(self):
        """Test basic writing and reading of ACLs"""
        self.make_temp_out_dirs()
        new_acl = AccessControlLists(())
        tempdir.chmod(0o700)
        new_acl.read_from_rp(tempdir)
        assert new_acl.is_basic(), str(new_acl)
        assert not new_acl == self.sample_acl
        assert new_acl != self.sample_acl
        assert new_acl == self.empty_acl, \
            (str(new_acl), str(self.empty_acl))

        self.sample_acl.write_to_rp(tempdir)
        new_acl.read_from_rp(tempdir)
        assert str(new_acl) == str(self.sample_acl), \
            (str(new_acl), str(self.sample_acl))
        assert new_acl == self.sample_acl