initial
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
# Tests if reservation can be created
|
||||
|
||||
# Create reservation
|
||||
POST http://localhost/wordpress/wp-json/reservations/v1/reservation
|
||||
{
|
||||
"metadata": {
|
||||
"email": "test@test.cz",
|
||||
"phone": "608 349 219"
|
||||
},
|
||||
"is_confirmed": null
|
||||
}
|
||||
HTTP 200
|
||||
[Captures]
|
||||
object_id: jsonpath "$"
|
||||
|
||||
# Get timetable
|
||||
GET http://localhost/wordpress/wp-json/reservations/v1/reservation/{{object_id}}
|
||||
HTTP 200
|
||||
[Asserts]
|
||||
jsonpath "$.name" == "Test Timetable"
|
||||
jsonpath "$.id" == "{{object_id}}"
|
||||
@@ -0,0 +1,47 @@
|
||||
# Tests if reservation can be created
|
||||
|
||||
# Create reservation type
|
||||
POST http://localhost/wordpress/wp-json/reservations/v1/type
|
||||
{
|
||||
"name": "test",
|
||||
"description": "testik",
|
||||
"configuration": {
|
||||
"steps": [
|
||||
{
|
||||
"index": 0,
|
||||
"type": "timetable",
|
||||
"configuration": {
|
||||
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
HTTP 200
|
||||
[Captures]
|
||||
reservation_type_id: jsonpath "$"
|
||||
|
||||
# Get timetable
|
||||
GET http://localhost/wordpress/wp-json/reservations/v1/type/{{reservation_type_id}}
|
||||
HTTP 200
|
||||
|
||||
# Create reservation
|
||||
POST http://localhost/wordpress/wp-json/reservations/v1/reservation
|
||||
{
|
||||
"metadata": {
|
||||
"email": "test@test.cz",
|
||||
"phone": "+420 608 349 219"
|
||||
},
|
||||
"is_confirmed": null,
|
||||
"reservation_type_id": {{reservation_type_id}},
|
||||
"steps": {
|
||||
"0": {
|
||||
"timetable_id": 1,
|
||||
"date": "2025-1-1",
|
||||
"start_time": "8:00",
|
||||
"end_time": "9:00"
|
||||
}
|
||||
}
|
||||
}
|
||||
HTTP 200
|
||||
[Captures]
|
||||
@@ -0,0 +1,22 @@
|
||||
# Tests if timetable can be created
|
||||
|
||||
# Create timetable
|
||||
POST http://localhost/wordpress/wp-json/reservations/v1/timetable
|
||||
{
|
||||
"name": "Test Timetable"
|
||||
}
|
||||
HTTP 200
|
||||
[Captures]
|
||||
object_id: jsonpath "$"
|
||||
|
||||
POST http://localhost/wordpress/wp-json/reservations/v1/timetable/{{object_id}}/capacity
|
||||
{
|
||||
"capacity": 2,
|
||||
"min_lead_time_minutes": 60,
|
||||
"date": "2025-1-1",
|
||||
"start_time": "8:00",
|
||||
"end_time": "12:00",
|
||||
"repeat_period_in_days": 7,
|
||||
"repeat_times": 0,
|
||||
"requires_confirmation": true
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
# Tests if timetable can be created
|
||||
|
||||
# Create timetable
|
||||
POST http://localhost/wordpress/wp-json/reservations/v1/timetable
|
||||
{
|
||||
"name": "Test Timetable"
|
||||
}
|
||||
HTTP 200
|
||||
[Captures]
|
||||
object_id: jsonpath "$"
|
||||
|
||||
# Get timetable
|
||||
GET http://localhost/wordpress/wp-json/reservations/v1/timetable/{{object_id}}
|
||||
HTTP 200
|
||||
[Asserts]
|
||||
jsonpath "$.name" == "Test Timetable"
|
||||
jsonpath "$.id" == "{{object_id}}"
|
||||
@@ -0,0 +1,22 @@
|
||||
# Create timetable
|
||||
POST http://localhost/wordpress/wp-json/reservations/v1/timetable
|
||||
{
|
||||
"name": "Test Timetable"
|
||||
}
|
||||
HTTP 200
|
||||
[Captures]
|
||||
object_id: jsonpath "$"
|
||||
|
||||
# Update timetable
|
||||
PUT http://localhost/wordpress/wp-json/reservations/v1/timetable/{{object_id}}
|
||||
{
|
||||
"name": "Test Timetable Updated"
|
||||
}
|
||||
HTTP 200
|
||||
|
||||
# Check timetable
|
||||
GET http://localhost/wordpress/wp-json/reservations/v1/timetable/{{object_id}}
|
||||
HTTP 200
|
||||
[Asserts]
|
||||
jsonpath "$.name" == "Test Timetable Updated"
|
||||
jsonpath "$.id" == {{object_id}}
|
||||
@@ -0,0 +1,81 @@
|
||||
# Tests if timetable reservation can be created
|
||||
|
||||
# Create timetable
|
||||
POST http://localhost/wordpress/wp-json/reservations/v1/timetable
|
||||
{
|
||||
"name": "Test Timetable"
|
||||
}
|
||||
HTTP 200
|
||||
[Captures]
|
||||
object_id: jsonpath "$"
|
||||
|
||||
|
||||
|
||||
POST http://localhost/wordpress/wp-json/reservations/v1/timetable/{{object_id}}/capacity
|
||||
{
|
||||
"capacity": 1,
|
||||
"min_lead_time_minutes": 60,
|
||||
"date": "2025-1-1",
|
||||
"start_time": "8:00",
|
||||
"end_time": "12:00",
|
||||
"repeat_period_in_days": 0,
|
||||
"repeat_times": 0,
|
||||
"requires_confirmation": true
|
||||
}
|
||||
HTTP 200
|
||||
|
||||
POST http://localhost/wordpress/wp-json/reservations/v1/timetable/{{object_id}}/capacity
|
||||
{
|
||||
"capacity": 1,
|
||||
"min_lead_time_minutes": 60,
|
||||
"date": "2025-1-1",
|
||||
"start_time": "13:00",
|
||||
"end_time": "18:00",
|
||||
"repeat_period_in_days": 0,
|
||||
"repeat_times": 0,
|
||||
"requires_confirmation": true
|
||||
}
|
||||
HTTP 200
|
||||
|
||||
|
||||
|
||||
POST http://localhost/wordpress/wp-json/reservations/v1/timetable/{{object_id}}/reservation
|
||||
{
|
||||
"timetable_id": {{object_id}},
|
||||
"reservation_id": 161,
|
||||
"date": "2025-1-1",
|
||||
"start_time": "8:00",
|
||||
"end_time": "9:00"
|
||||
}
|
||||
HTTP 200
|
||||
|
||||
POST http://localhost/wordpress/wp-json/reservations/v1/timetable/{{object_id}}/reservation
|
||||
{
|
||||
"timetable_id": {{object_id}},
|
||||
"reservation_id": 161,
|
||||
"date": "2025-1-1",
|
||||
"start_time": "11:30",
|
||||
"end_time": "12:30"
|
||||
}
|
||||
HTTP 400
|
||||
|
||||
POST http://localhost/wordpress/wp-json/reservations/v1/timetable/{{object_id}}/reservation
|
||||
{
|
||||
"timetable_id": {{object_id}},
|
||||
"reservation_id": 161,
|
||||
"date": "2025-1-1",
|
||||
"start_time": "11:30",
|
||||
"end_time": "13:30"
|
||||
}
|
||||
HTTP 400
|
||||
|
||||
|
||||
POST http://localhost/wordpress/wp-json/reservations/v1/timetable/{{object_id}}/reservation
|
||||
{
|
||||
"timetable_id": {{object_id}},
|
||||
"reservation_id": 161,
|
||||
"date": "2025-1-1",
|
||||
"start_time": "12:30",
|
||||
"end_time": "13:30"
|
||||
}
|
||||
HTTP 400
|
||||
@@ -0,0 +1,13 @@
|
||||
GET http://localhost/wordpress/wp-json/reservations/v1/object/1/action
|
||||
HTTP 200
|
||||
|
||||
PATCH http://localhost/wordpress/wp-json/reservations/v1/object/1/action
|
||||
[8, 9]
|
||||
HTTP 204
|
||||
|
||||
GET http://localhost/wordpress/wp-json/reservations/v1/object/1/action
|
||||
HTTP 200
|
||||
[Asserts]
|
||||
jsonpath "$" count == 2
|
||||
jsonpath "$[0].reservation_action_id" == "8"
|
||||
jsonpath "$[1].reservation_action_id" == "9"
|
||||
@@ -0,0 +1,188 @@
|
||||
# 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
|
||||
@@ -0,0 +1,49 @@
|
||||
# If available times are created properly
|
||||
#
|
||||
# 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": 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
|
||||
|
||||
GET http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/available
|
||||
HTTP 200
|
||||
[Asserts]
|
||||
jsonpath "$[0].first_date" == "2025-09-01"
|
||||
jsonpath "$[1].first_date" == "2025-09-03"
|
||||
jsonpath "$[2].first_date" == "2025-09-05"
|
||||
jsonpath "$[3].first_date" == "2025-08-31"
|
||||
|
||||
DELETE http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}
|
||||
HTTP 200
|
||||
@@ -0,0 +1,13 @@
|
||||
# create reservation type
|
||||
POST http://localhost/wordpress/wp-json/reservations/v1/type
|
||||
{
|
||||
"name": "test",
|
||||
"description": "description of test",
|
||||
"configuration": [
|
||||
{
|
||||
"index": 1,
|
||||
"type": "Timetable"
|
||||
}
|
||||
]
|
||||
}
|
||||
HTTP 201
|
||||
@@ -0,0 +1,29 @@
|
||||
# test objects
|
||||
GET http://localhost/wordpress/wp-json/reservations/v1/object
|
||||
HTTP 200
|
||||
[Asserts]
|
||||
jsonpath "$" isEmpty
|
||||
|
||||
POST http://localhost/wordpress/wp-json/reservations/v1/object
|
||||
{
|
||||
"name": "TestObject1"
|
||||
}
|
||||
HTTP 200
|
||||
|
||||
GET http://localhost/wordpress/wp-json/reservations/v1/object
|
||||
HTTP 200
|
||||
[Captures]
|
||||
object_id: jsonpath "$[0].reservation_object_id"
|
||||
[Asserts]
|
||||
jsonpath "$" count == 1
|
||||
jsonpath "$[0].name" == "TestObject1"
|
||||
jsonpath "$[0].is_readonly" == "0"
|
||||
|
||||
DELETE http://localhost/wordpress/wp-json/reservations/v1/object/a
|
||||
HTTP 404
|
||||
|
||||
DELETE http://localhost/wordpress/wp-json/reservations/v1/object/1
|
||||
HTTP 404
|
||||
|
||||
DELETE http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}
|
||||
HTTP 200
|
||||
@@ -0,0 +1,64 @@
|
||||
# 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": "10:00",
|
||||
"is_repeating": false,
|
||||
"requires_confirmation": false
|
||||
}
|
||||
HTTP 200
|
||||
[Asserts]
|
||||
jsonpath "$" count == 1
|
||||
|
||||
|
||||
GET http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/reservation/occupancy?date=2025-08-31
|
||||
HTTP 200
|
||||
[Asserts]
|
||||
jsonpath "$.occupancy" count == 4
|
||||
|
||||
jsonpath "$.occupancy[0]" == 0
|
||||
jsonpath "$.occupancy[1]" == 0
|
||||
jsonpath "$.occupancy[2]" == 0
|
||||
jsonpath "$.occupancy[3]" == 0
|
||||
|
||||
POST http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/reservation
|
||||
{
|
||||
"timetable_id": {{object_id}},
|
||||
"date": "2025-08-31",
|
||||
"email": "test@test",
|
||||
"full_name": "Test Test",
|
||||
"phone": "123 456 789",
|
||||
"reservations": [
|
||||
{
|
||||
"start_block_idx": 16,
|
||||
"num_blocks": 2
|
||||
}
|
||||
]
|
||||
}
|
||||
HTTP 200
|
||||
|
||||
GET http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/reservation/occupancy?date=2025-08-31
|
||||
HTTP 200
|
||||
[Asserts]
|
||||
jsonpath "$.occupancy" count == 4
|
||||
|
||||
jsonpath "$.occupancy[0]" == 1
|
||||
jsonpath "$.occupancy[1]" == 1
|
||||
jsonpath "$.occupancy[2]" == 0
|
||||
jsonpath "$.occupancy[3]" == 0
|
||||
@@ -0,0 +1,172 @@
|
||||
# Create object with timetable
|
||||
POST http://localhost/wordpress/wp-json/reservations/v1/object
|
||||
{
|
||||
"name": "TestObject1",
|
||||
"timetable": {
|
||||
"block_len": 30,
|
||||
"block_capacity": 2
|
||||
}
|
||||
}
|
||||
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": "10:00",
|
||||
"is_repeating": true,
|
||||
"requires_confirmation": false,
|
||||
"repeat_period": 7,
|
||||
"repeat_times": 0,
|
||||
"monday": true,
|
||||
"tuesday": false,
|
||||
"wednesday": true,
|
||||
"thursday": false,
|
||||
"friday": true,
|
||||
"saturday": false,
|
||||
"sunday": true
|
||||
}
|
||||
HTTP 200
|
||||
[Asserts]
|
||||
jsonpath "$" count == 4
|
||||
|
||||
|
||||
GET http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/reservation/occupancy?date=2025-08-31
|
||||
HTTP 200
|
||||
[Asserts]
|
||||
jsonpath "$.occupancy" count == 4
|
||||
|
||||
jsonpath "$.occupancy[0]" == 0
|
||||
jsonpath "$.occupancy[1]" == 0
|
||||
jsonpath "$.occupancy[2]" == 0
|
||||
jsonpath "$.occupancy[3]" == 0
|
||||
|
||||
POST http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/reservation
|
||||
{
|
||||
"timetable_id": {{object_id}},
|
||||
"date": "2025-08-31",
|
||||
"email": "test@test",
|
||||
"full_name": "Test Test",
|
||||
"phone": "123 456 789",
|
||||
"reservations": [
|
||||
{
|
||||
"start_block_idx": 16,
|
||||
"num_blocks": 2
|
||||
}
|
||||
]
|
||||
}
|
||||
HTTP 200
|
||||
|
||||
POST http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/reservation
|
||||
{
|
||||
"timetable_id": {{object_id}},
|
||||
"date": "2025-09-07",
|
||||
"email": "test@test",
|
||||
"full_name": "Test Test",
|
||||
"phone": "123 456 789",
|
||||
"reservations": [
|
||||
{
|
||||
"start_block_idx": 16,
|
||||
"num_blocks": 2
|
||||
}
|
||||
]
|
||||
}
|
||||
HTTP 200
|
||||
|
||||
|
||||
# not available time
|
||||
POST http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/reservation
|
||||
{
|
||||
"timetable_id": {{object_id}},
|
||||
"date": "2025-09-06",
|
||||
"email": "test@test",
|
||||
"full_name": "Test Test",
|
||||
"phone": "123 456 789",
|
||||
"reservations": [
|
||||
{
|
||||
"start_block_idx": 16,
|
||||
"num_blocks": 2
|
||||
}
|
||||
]
|
||||
}
|
||||
HTTP 400
|
||||
|
||||
|
||||
# Availabel time, still has capacity
|
||||
POST http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/reservation
|
||||
{
|
||||
"timetable_id": {{object_id}},
|
||||
"date": "2025-09-07",
|
||||
"email": "test@test",
|
||||
"full_name": "Test Test",
|
||||
"phone": "123 456 789",
|
||||
"reservations": [
|
||||
{
|
||||
"start_block_idx": 17,
|
||||
"num_blocks": 2
|
||||
}
|
||||
]
|
||||
}
|
||||
HTTP 200
|
||||
|
||||
GET http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/reservation/occupancy?date=2025-09-07
|
||||
HTTP 200
|
||||
[Asserts]
|
||||
jsonpath "$.occupancy" count == 4
|
||||
|
||||
jsonpath "$.occupancy[0]" == 1
|
||||
jsonpath "$.occupancy[1]" == 2
|
||||
jsonpath "$.occupancy[2]" == 1
|
||||
jsonpath "$.occupancy[3]" == 0
|
||||
|
||||
POST http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/reservation
|
||||
{
|
||||
"timetable_id": {{object_id}},
|
||||
"date": "2025-09-07",
|
||||
"email": "test@test",
|
||||
"full_name": "Test Test",
|
||||
"phone": "123 456 789",
|
||||
"reservations": [
|
||||
{
|
||||
"start_block_idx": 18,
|
||||
"num_blocks": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
HTTP 200
|
||||
|
||||
POST http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/reservation
|
||||
{
|
||||
"timetable_id": {{object_id}},
|
||||
"date": "2025-09-07",
|
||||
"email": "test@test",
|
||||
"full_name": "Test Test",
|
||||
"phone": "123 456 789",
|
||||
"reservations": [
|
||||
{
|
||||
"start_block_idx": 18,
|
||||
"num_blocks": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
HTTP 400
|
||||
|
||||
POST http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/reservation
|
||||
{
|
||||
"timetable_id": {{object_id}},
|
||||
"date": "2025-09-07",
|
||||
"email": "test@test",
|
||||
"full_name": "Test Test",
|
||||
"phone": "123 456 789",
|
||||
"reservations": [
|
||||
{
|
||||
"start_block_idx": 16,
|
||||
"num_blocks": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
HTTP 400
|
||||
@@ -0,0 +1,144 @@
|
||||
# Create object with timetable
|
||||
POST http://localhost/wordpress/wp-json/reservations/v1/object
|
||||
{
|
||||
"name": "TestObject1",
|
||||
"timetable": {
|
||||
"block_len": 30,
|
||||
"block_capacity": 2
|
||||
}
|
||||
}
|
||||
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": "10:00",
|
||||
"is_repeating": false,
|
||||
"requires_confirmation": false
|
||||
}
|
||||
HTTP 200
|
||||
[Asserts]
|
||||
jsonpath "$" count == 1
|
||||
|
||||
|
||||
GET http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/reservation/occupancy?date=2025-08-31
|
||||
HTTP 200
|
||||
[Asserts]
|
||||
jsonpath "$.occupancy" count == 4
|
||||
|
||||
jsonpath "$.occupancy[0]" == 0
|
||||
jsonpath "$.occupancy[1]" == 0
|
||||
jsonpath "$.occupancy[2]" == 0
|
||||
jsonpath "$.occupancy[3]" == 0
|
||||
|
||||
POST http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/reservation
|
||||
{
|
||||
"timetable_id": {{object_id}},
|
||||
"date": "2025-08-31",
|
||||
"email": "test@test",
|
||||
"full_name": "Test Test",
|
||||
"phone": "123 456 789",
|
||||
"reservations": [
|
||||
{
|
||||
"start_block_idx": 16,
|
||||
"num_blocks": 2
|
||||
}
|
||||
]
|
||||
}
|
||||
HTTP 200
|
||||
|
||||
GET http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/reservation/occupancy?date=2025-08-31
|
||||
HTTP 200
|
||||
[Asserts]
|
||||
jsonpath "$.occupancy" count == 4
|
||||
|
||||
jsonpath "$.occupancy[0]" == 1
|
||||
jsonpath "$.occupancy[1]" == 1
|
||||
jsonpath "$.occupancy[2]" == 0
|
||||
jsonpath "$.occupancy[3]" == 0
|
||||
|
||||
|
||||
|
||||
POST http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/reservation
|
||||
{
|
||||
"timetable_id": {{object_id}},
|
||||
"date": "2025-08-31",
|
||||
"email": "test@test",
|
||||
"full_name": "Test Test",
|
||||
"phone": "123 456 789",
|
||||
"reservations": [
|
||||
{
|
||||
"start_block_idx": 17,
|
||||
"num_blocks": 2
|
||||
}
|
||||
]
|
||||
}
|
||||
HTTP 200
|
||||
|
||||
GET http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/reservation/occupancy?date=2025-08-31
|
||||
HTTP 200
|
||||
[Asserts]
|
||||
jsonpath "$.occupancy" count == 4
|
||||
|
||||
jsonpath "$.occupancy[0]" == 1
|
||||
jsonpath "$.occupancy[1]" == 2
|
||||
jsonpath "$.occupancy[2]" == 1
|
||||
jsonpath "$.occupancy[3]" == 0
|
||||
|
||||
|
||||
|
||||
POST http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/reservation
|
||||
{
|
||||
"timetable_id": {{object_id}},
|
||||
"date": "2025-08-31",
|
||||
"email": "test@test",
|
||||
"full_name": "Test Test",
|
||||
"phone": "123 456 789",
|
||||
"reservations": [
|
||||
{
|
||||
"start_block_idx": 17,
|
||||
"num_blocks": 2
|
||||
}
|
||||
]
|
||||
}
|
||||
HTTP 400
|
||||
|
||||
|
||||
POST http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/reservation
|
||||
{
|
||||
"timetable_id": {{object_id}},
|
||||
"date": "2025-08-31",
|
||||
"email": "test@test",
|
||||
"full_name": "Test Test",
|
||||
"phone": "123 456 789",
|
||||
"reservations": [
|
||||
{
|
||||
"start_block_idx": 16,
|
||||
"num_blocks": 2
|
||||
}
|
||||
]
|
||||
}
|
||||
HTTP 400
|
||||
|
||||
|
||||
POST http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/reservation
|
||||
{
|
||||
"timetable_id": {{object_id}},
|
||||
"date": "2025-08-31",
|
||||
"email": "test@test",
|
||||
"full_name": "Test Test",
|
||||
"phone": "123 456 789",
|
||||
"reservations": [
|
||||
{
|
||||
"start_block_idx": 17,
|
||||
"num_blocks": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
HTTP 400
|
||||
@@ -0,0 +1,15 @@
|
||||
POST http://localhost/wordpress/wp-json/reservations/v1/object/2/timetable/reservation
|
||||
{
|
||||
"timetable_id": 2,
|
||||
"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
|
||||
@@ -0,0 +1 @@
|
||||
GET
|
||||
@@ -0,0 +1,20 @@
|
||||
POST http://localhost/wordpress/wp-json/reservations/v1/object
|
||||
{
|
||||
"name": "TestObject1"
|
||||
}
|
||||
HTTP 200
|
||||
[Captures]
|
||||
object_id: jsonpath "$[0]"
|
||||
|
||||
GET http://localhost/wordpress/wp-json/reservations/v1/object
|
||||
HTTP 200
|
||||
[Asserts]
|
||||
jsonpath "$[-1:].reservation_object_id" count == 1
|
||||
jsonpath "$[-1:].reservation_object_id[0]" == {{object_id}}
|
||||
|
||||
# Create it's timetable
|
||||
POST http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable
|
||||
{
|
||||
"block_len": 30
|
||||
}
|
||||
HTTP 200
|
||||
Reference in New Issue
Block a user