def rooms_create(): user_ids = request.form.get('user_ids', '').split(',') users = User.get_list(user_ids) if g.me in users: users.append(g.me) room = Room.create(users) return jsonify(room)
def room(): room_data = {"name": fake.name()} room = Room.create(**room_data) yield room.serialize() room.delete()
def setup(self): database_create(k_database) database.connect(k_database) system = User(0) self.room_id = Room.create("Test Room", system) self.room_controller = RoomController(self.room_id)
def create_internal(self, name, owner): room_id = Room.create(name, owner) recreated_room = Room(room_id) assert_equals(room_id, recreated_room.room_id) assert_equals(name, recreated_room.name) assert_equals(owner, recreated_room.owner) return recreated_room
def create_room(roomData: RoomType): """ Create a new room. """ try: name = roomData.name Room.validate(name) room = Room.create(name=name) headers = {"Content-Location": f"/v1/rooms/{room.id}"} msg = "Room created successfully." log.info(f"{msg} with id: {room.id}") return HTTP_201, {"message": msg}, headers except ConflictError as error: raise HTTPError(HTTP_409, {"errors": str(error)})