189 lines
4.4 KiB
Plaintext
189 lines
4.4 KiB
Plaintext
# Create object with timetable
|
|
POST http://localhost/wordpress/wp-json/reservations/v1/object
|
|
{
|
|
"name": "TestObject1",
|
|
"timetable": {
|
|
"block_len": 30,
|
|
"block_capacity": 1
|
|
}
|
|
}
|
|
HTTP 200
|
|
[Captures]
|
|
object_id: jsonpath "$[0]"
|
|
|
|
|
|
|
|
POST http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/available
|
|
{
|
|
"timetable_id": {{object_id}},
|
|
"first_date": "2025-08-31",
|
|
"start": "8:00",
|
|
"end": "16:00",
|
|
"is_repeating": false,
|
|
"requires_confirmation": false
|
|
}
|
|
HTTP 200
|
|
[Asserts]
|
|
jsonpath "$" count == 1
|
|
|
|
|
|
|
|
POST http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/available
|
|
{
|
|
"timetable_id": {{object_id}},
|
|
"first_date": "2025-08-31",
|
|
"start": "8:00",
|
|
"end": "16:00",
|
|
"is_repeating": true,
|
|
"repeat_period": 7,
|
|
"repeat_times": 0,
|
|
"monday": true,
|
|
"tuesday": false,
|
|
"wednesday": true,
|
|
"thursday": false,
|
|
"friday": true,
|
|
"saturday": false,
|
|
"sunday": true,
|
|
"requires_confirmation": false
|
|
}
|
|
HTTP 200
|
|
[Asserts]
|
|
jsonpath "$" count == 4
|
|
jsonpath "$[0].first_date" == "2025-08-31"
|
|
jsonpath "$[1].first_date" == "2025-08-31"
|
|
jsonpath "$[2].first_date" == "2025-08-31"
|
|
jsonpath "$[3].first_date" == "2025-08-31"
|
|
|
|
|
|
GET http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/available?date=2025-08-31
|
|
HTTP 200
|
|
|
|
POST http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/reservation
|
|
{
|
|
"timetable_id": {{object_id}},
|
|
"date": "2025-8-31",
|
|
"email": "test@test",
|
|
"full_name": "Test Test",
|
|
"phone": "123 456 789",
|
|
"reservations": [
|
|
{
|
|
"start_block_idx": 16,
|
|
"num_blocks": 1
|
|
}
|
|
]
|
|
}
|
|
HTTP 200
|
|
|
|
GET http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/reservation
|
|
HTTP 200
|
|
[Captures]
|
|
count: jsonpath "$" count
|
|
|
|
# Overlapping
|
|
POST http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/reservation
|
|
{
|
|
"timetable_id": {{object_id}},
|
|
"date": "2025-8-31",
|
|
"email": "test@test",
|
|
"full_name": "Test Test",
|
|
"phone": "123 456 789",
|
|
"reservations": [
|
|
{
|
|
"start_block_idx": 16,
|
|
"num_blocks": 1
|
|
}
|
|
]
|
|
}
|
|
HTTP 400
|
|
|
|
GET http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/reservation
|
|
HTTP 200
|
|
[Asserts]
|
|
jsonpath "$" count == {{count}}
|
|
|
|
# Cannot create outside available time
|
|
POST http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/reservation
|
|
{
|
|
"timetable_id": {{object_id}},
|
|
"date": "2025-8-31",
|
|
"email": "test@test",
|
|
"full_name": "Test Test",
|
|
"phone": "123 456 789",
|
|
"reservations": [
|
|
{
|
|
"start_block_idx": 34,
|
|
"num_blocks": 1
|
|
}
|
|
]
|
|
}
|
|
HTTP 400
|
|
|
|
# Not even end outside available time
|
|
POST http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/reservation
|
|
{
|
|
"timetable_id": {{object_id}},
|
|
"date": "2025-8-31",
|
|
"email": "test@test",
|
|
"full_name": "Test Test",
|
|
"phone": "123 456 789",
|
|
"reservations": [
|
|
{
|
|
"start_block_idx": 30,
|
|
"num_blocks": 4
|
|
}
|
|
]
|
|
}
|
|
HTTP 400
|
|
|
|
|
|
GET http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/reservation
|
|
HTTP 200
|
|
[Asserts]
|
|
jsonpath "$" count == {{count}}
|
|
|
|
|
|
# When one fails, none is inserted
|
|
POST http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/reservation
|
|
{
|
|
"timetable_id": {{object_id}},
|
|
"date": "2025-8-31",
|
|
"email": "test@test",
|
|
"full_name": "Test Test",
|
|
"phone": "123 456 789",
|
|
"reservations": [
|
|
{
|
|
"start_block_idx": 20,
|
|
"num_blocks": 1
|
|
}, {
|
|
"from": 36,
|
|
"num_blocks": 1
|
|
}
|
|
]
|
|
}
|
|
HTTP 400
|
|
|
|
|
|
GET http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/reservation
|
|
HTTP 200
|
|
[Asserts]
|
|
jsonpath "$" count == {{count}}
|
|
|
|
POST http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/reservation
|
|
{
|
|
"timetable_id": {{object_id}},
|
|
"date": "2025-8-31",
|
|
"email": "test@test",
|
|
"full_name": "Test Test",
|
|
"phone": "123 456 789",
|
|
"reservations": [
|
|
{
|
|
"start_block_idx": 31,
|
|
"num_blocks": 1
|
|
}
|
|
]
|
|
}
|
|
HTTP 200
|
|
|
|
DELETE http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}
|
|
HTTP 200
|