Exemplo n.º 1
0
    def test_save_user(self):
        user = User("foo-user", "password")

        assert user.create(self.connection).description() is None
        user.set_description("This is the foo user")

        user.update(self.connection)

        user = User.lookup(self.connection, "foo-user")
        assert "This is the foo user" == user.description()

        user.delete(self.connection)
Exemplo n.º 2
0
    def test_save_user(self):
        connection = Connection.make_connection(tc.hostname, tc.admin, tc.password)
        user = User("foo-user", "password")

        self.assertIsNone(user.create(connection).description())
        user.set_description("This is the foo user")

        user.update(connection)

        user = User.lookup(connection, "foo-user")
        self.assertEqual("This is the foo user", user.description())

        user.delete(connection)
    def test_save_user(self):
        connection = Connection.make_connection(tc.hostname, tc.admin,
                                                tc.password)
        user = User("foo-user", "password")

        self.assertIsNone(user.create(connection).description())
        user.set_description("This is the foo user")

        user.update(connection)

        user = User.lookup(connection, "foo-user")
        self.assertEqual("This is the foo user", user.description())

        user.delete(connection)
Exemplo n.º 4
0
    def modify(self, args, config, connection):
        user = User(args['name'], connection=connection)
        if not user.exists():
            print("Error: User does not exist: {0}".format(args['name']))
            sys.exit(1)

        if args['json'] is not None:
            user = self._read(args['name'], args['json'])

        self.roles = []
        self._properties(user, args)
        if len(self.roles) > 0:
            user.set_role_names(self.roles)

        print("Modify user {0}...".format(args['name']))
        user.update(connection)
Exemplo n.º 5
0
    def modify(self, args, config, connection):
        user = User(args['name'], connection=connection)
        if not user.exists():
            print("Error: User does not exist: {0}".format(args['name']))
            sys.exit(1)

        if args['json'] is not None:
            user = self._read(args['name'], args['json'])

        self.roles = []
        self._properties(user, args)
        if len(self.roles) > 0:
            user.set_role_names(self.roles)

        print("Modify user {0}...".format(args['name']))
        user.update(connection)