Пример #1
0
    def test_add_role(self):
        privilege = Privilege("foo-privilege", kind="execute", action="http://example.com/")

        privilege.add_role_name(u"manage-admin")

        role = privilege.role_names()[0]
        assert u"manage-admin" == role
    def test_add_role(self):
        privilege = Privilege("foo-privilege","http://example.com/","execute")

        privilege.add_role_name(u'manage-admin')

        role = privilege.role_names()[0]
        self.assertEqual(u'manage-admin', role)
    def test_add_role(self):
        privilege = Privilege("foo-privilege",
                              kind="execute",
                              action="http://example.com/")

        privilege.add_role_name(u'manage-admin')

        role = privilege.role_names()[0]
        assert u'manage-admin' == role
Пример #4
0
    def test_save_privilege(self):
        privilege = Privilege("foo-privilege", kind="execute", action="http://example.com/")
        privilege.create(self.connection)

        privilege.add_role_name("manage-user")
        privilege.update(self.connection)

        assert "manage-user" in privilege.role_names()

        privilege.delete(self.connection)
Пример #5
0
    def test_create_remove_privilege(self):
        privilege = Privilege("foo-privilege", kind="execute", action="http://example.com/")

        privilege.create(self.connection)

        the_privilege = Privilege.lookup(self.connection, kind="execute", action="http://example.com/")
        assert the_privilege is not None

        the_privilege.delete(self.connection)
        the_privilege = Privilege.lookup(self.connection, kind="execute", action="foo-privilege")
        assert the_privilege is None
Пример #6
0
    def test_lookup_action(self):
        privilege = Privilege.lookup(
            self.connection, kind="execute", action="http://marklogic.com/xdmp/privileges/admin-module-write"
        )

        assert privilege is not None
        assert "admin-module-write" == privilege.privilege_name()
    def test_lookup(self):
        connection = Connection.make_connection(tc.hostname, tc.admin, tc.password)

        privilege = Privilege.lookup(connection, "manage-admin", "execute")

        self.assertIsNotNone(privilege)
        self.assertEqual(privilege.privilege_name(), "manage-admin")
    def test_lookup(self):
        privilege = Privilege.lookup(self.connection,
                                     name="manage-admin",
                                     kind="execute")

        assert privilege is not None
        assert "manage-admin" == privilege.privilege_name()
    def test_list(self):
        connection = Connection.make_connection(tc.hostname, tc.admin, tc.password)

        privileges = Privilege.list(connection)

        self.assertGreater(len(privileges), 300)
        self.assertIn("execute|manage-admin", privileges)
    def test_lookup_action(self):
        connection = Connection.make_connection(tc.hostname, tc.admin, tc.password)

        privilege = Privilege.lookup(connection, kind="execute", \
          action="http://marklogic.com/xdmp/privileges/admin-module-write")

        self.assertIsNotNone(privilege)
        self.assertEqual(privilege.privilege_name(), "admin-module-write")
    def test_lookup_action(self):
        privilege = Privilege.lookup(
            self.connection,
            kind="execute",
            action="http://marklogic.com/xdmp/privileges/admin-module-write")

        assert privilege is not None
        assert "admin-module-write" == privilege.privilege_name()
    def test_create_privilege(self):
        connection = Connection.make_connection(tc.hostname, tc.admin, tc.password)
        new_privilege = Privilege("foo-privilege","http://example.com/","execute")

        self.assertEqual(new_privilege.privilege_name(), "foo-privilege")

        new_privilege.create(connection)

        privileges = Privilege.list(connection)
        self.assertIn("execute|foo-privilege", privileges)

        new_privilege.delete(connection)
    def test_create_privilege(self):
        new_privilege = Privilege("foo-privilege",
                                  kind="execute",
                                  action="http://example.com/")

        assert "foo-privilege" == new_privilege.privilege_name()

        new_privilege.create(self.connection)

        privileges = Privilege.list(self.connection)
        assert "execute|foo-privilege" in privileges

        new_privilege.delete(self.connection)
Пример #14
0
    def test_create_privilege(self):
        new_privilege = Privilege("foo-privilege", kind="execute", action="http://example.com/")

        assert "foo-privilege" == new_privilege.privilege_name()

        new_privilege.create(self.connection)

        privileges = Privilege.list(self.connection)
        assert "execute|foo-privilege" in privileges

        new_privilege.delete(self.connection)
    def test_create_remove_privilege(self):
        connection = Connection.make_connection(tc.hostname, tc.admin, tc.password)
        privilege = Privilege("foo-privilege","http://example.com/","execute")

        privilege.create(connection)

        the_privilege = Privilege.lookup(connection, "foo-privilege", "execute")
        self.assertIsNotNone(the_privilege)

        the_privilege.delete(connection)
        the_privilege = Privilege.lookup(connection, "foo-privilege", "execute")
        self.assertIsNone(the_privilege)
    def test_create_remove_privilege(self):
        privilege = Privilege("foo-privilege",
                              kind="execute",
                              action="http://example.com/")

        privilege.create(self.connection)

        the_privilege = Privilege.lookup(self.connection,
                                         kind="execute",
                                         action="http://example.com/")
        assert the_privilege is not None

        the_privilege.delete(self.connection)
        the_privilege = Privilege.lookup(self.connection,
                                         kind="execute",
                                         action="foo-privilege")
        assert the_privilege is None
Пример #17
0
    def test_lookup(self):
        privilege = Privilege.lookup(self.connection, name="manage-admin", kind="execute")

        assert privilege is not None
        assert "manage-admin" == privilege.privilege_name()
Пример #18
0
    def test_list(self):
        privileges = Privilege.list(self.connection)

        assert len(privileges) > 300
        assert "execute|manage-admin" in privileges
    def test_save_privilege(self):
        privilege = Privilege("foo-privilege",
                              kind="execute",
                              action="http://example.com/")
        privilege.create(self.connection)

        privilege.add_role_name("manage-user")
        privilege.update(self.connection)

        assert "manage-user" in privilege.role_names()

        privilege.delete(self.connection)
    def test_save_privilege(self):
        connection = Connection.make_connection(tc.hostname, tc.admin, tc.password)
        privilege = Privilege("foo-privilege","http://example.com/","execute")
        privilege.create(connection)

        privilege.add_role_name("manage-user")
        privilege.update(connection)

        self.assertIn("manage-user", privilege.role_names())

        privilege.delete(connection)
    def test_list(self):
        privileges = Privilege.list(self.connection)

        assert len(privileges) > 300
        assert "execute|manage-admin" in privileges