From 8ea79dd19b511b766599ba226e48e99daf350902 Mon Sep 17 00:00:00 2001 From: Pengju Jiao Date: Fri, 9 Dec 2016 18:17:41 +0800 Subject: [PATCH] Add session scheduling information validation. Change-Id: Ie704a3ee31a56a1fd86d331b3c5cc79795358506 Closes-Bug: #1587069 --- freezer_api/common/json_schemas.py | 18 +++++++++++++++--- freezer_api/tests/unit/common.py | 8 ++++---- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/freezer_api/common/json_schemas.py b/freezer_api/common/json_schemas.py index fa93b550..30b63d78 100644 --- a/freezer_api/common/json_schemas.py +++ b/freezer_api/common/json_schemas.py @@ -51,7 +51,7 @@ freezer_action_properties = { }, } -job_schedule_properties = { +schedule_properties = { "time_created": { "id": "time_created", "type": "integer" @@ -187,7 +187,7 @@ job_schema = { "job_schedule": { "id": "job_schedule", "type": "object", - "properties": job_schedule_properties, + "properties": schedule_properties, "additionalProperties": False, }, "job_id": { @@ -278,7 +278,7 @@ job_patch_schema = { "job_schedule": { "id": "job_schedule", "type": "object", - "properties": job_schedule_properties, + "properties": schedule_properties, "additionalProperties": False, }, "job_id": { @@ -368,6 +368,12 @@ session_schema = { "id": "/", "type": "object", "properties": { + "schedule": { + "id": "schedule", + "type": "object", + "properties": schedule_properties, + "additionalProperties": False, + }, "session_id": { "id": "session_id", "pattern": "^[\w-]+$", @@ -403,6 +409,12 @@ session_patch_schema = { "id": "/", "type": "object", "properties": { + "schedule": { + "id": "schedule", + "type": "object", + "properties": schedule_properties, + "additionalProperties": False, + }, "session_id": { "id": "session_id", "pattern": "^[\w-]+$", diff --git a/freezer_api/tests/unit/common.py b/freezer_api/tests/unit/common.py index 64adfdcb..598bb625 100644 --- a/freezer_api/tests/unit/common.py +++ b/freezer_api/tests/unit/common.py @@ -355,8 +355,8 @@ fake_session_0 = { "time_created": 1234, "time_started": 1234, "time_ended": 0, - "status": "invalid", - "schedule_time": "2015-06-02T16:20:00" + "status": "stop", + "schedule_date": "2015-06-02T16:20:00" }, "jobs": { 'venerescollataincorpodalolita': { @@ -387,8 +387,8 @@ fake_session_1 = { "time_created": 1234, "time_started": 1234, "time_ended": 0, - "status": "invalid", - "schedule_time": "2015-06-02T16:20:00" + "status": "stop", + "schedule_date": "2015-06-02T16:20:00" }, "jobs": { 'venerescollataincorpodalolita': {