def test_list(client, db_session): """ Test getting list of Scheme types """ db_session.add(SchemeType(description="Test scheme type", default_value="1", value_type="Integer")) db_session.commit() types = client.get(url_for("scheme_type.list")) assert types.status_code == HTTPStatus.OK assert b"Test scheme type" in types.data
def test_new_scheme_type(): scheme_type = SchemeType(id=1, description="description", default_value="2", value_type="STRING") assert (scheme_type.id == 1 and scheme_type.description == "description" and scheme_type.default_value == "2" and scheme_type.value_type == "STRING")
def test_new_table(): id = 42 name = "Philosopher's Table" floor_id = 600, x = 40, y = 50, width = 320, height = 200, status = "available", max_capacity = 5, multiple = False, playstation = False, shape_id = 3 created = datetime.utcnow updated = datetime.utcnow min_capacity = SchemeType() deposit_hour = SchemeType() new_table = Table(id=id, name=name, floor_id=floor_id, x=x, y=y, width=width, height=height, status=status, max_capacity=max_capacity, multiple=multiple, playstation=playstation, shape_id=shape_id, created=created, updated=updated, min_capacity=min_capacity.id, deposit_hour=deposit_hour.id) assert (new_table.id == id and new_table.name == name and new_table.floor_id == floor_id and new_table.x == x and new_table.y == y and new_table.width == width and new_table.height == height and new_table.status == status and new_table.max_capacity == max_capacity and new_table.multiple == multiple and new_table.playstation == playstation and new_table.shape_id == shape_id, new_table.created == created, new_table.updated == updated and new_table.min_capacity == min_capacity.id and new_table.deposit_hour == deposit_hour.id)
def test_new_location(): name = "Test location" code = "L" company_id = 123 poster_id = 100 synchronized_on = datetime.utcnow working_hours = SchemeType() closed_days = SchemeType() new_location = Location(name=name, code=code, company_id=company_id, poster_id=poster_id, synchronized_on=synchronized_on, working_hours=working_hours.id, closed_days=closed_days.id) assert (new_location.name == name and new_location.code == code and new_location.company_id == company_id and new_location.poster_id == 100 and new_location.synchronized_on == synchronized_on and new_location.working_hours == working_hours.id and new_location.closed_days == closed_days.id)
def test_scheme_condition_list(client, db_session): """ Test getting list of Scheme conditions for Scheme type """ scheme_type = SchemeType(description="Scheme type", default_value="2", value_type="String") db_session.add(scheme_type) db_session.commit() db_session.add( SchemeCondition(scheme_type_id=scheme_type.id, value="Test condition", priority=1, start_time=datetime.utcnow(), end_time=datetime.utcnow())) db_session.commit() conditions = client.get( url_for("scheme_type.scheme_condition_list", scheme_type_id=scheme_type.id)) assert conditions.status_code == HTTPStatus.OK assert b"Test condition" in conditions.data