mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-02 09:26:08 -05:00
Update schema to allow include_jobs on get_notis
This commit is contained in:
@@ -74,6 +74,7 @@ get_notifications_request = {
|
||||
"enum": TEMPLATE_TYPES
|
||||
}
|
||||
},
|
||||
"include_jobs": {"enum": ["true", "True"]},
|
||||
"older_than": uuid
|
||||
},
|
||||
"additionalProperties": False,
|
||||
@@ -88,7 +89,7 @@ get_notifications_response = {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"ref": get_notification_response
|
||||
"$ref": "#/definitions/notification"
|
||||
}
|
||||
},
|
||||
"links": {
|
||||
@@ -106,7 +107,11 @@ get_notifications_response = {
|
||||
}
|
||||
},
|
||||
"additionalProperties": False,
|
||||
"required": ["notifications", "links"]
|
||||
"required": ["notifications", "links"],
|
||||
"definitions": {
|
||||
"notification": get_notification_response
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
post_sms_request = {
|
||||
|
||||
@@ -5,6 +5,7 @@ from flask import json
|
||||
from freezegun import freeze_time
|
||||
from jsonschema import ValidationError
|
||||
|
||||
from app.models import NOTIFICATION_CREATED, EMAIL_TYPE
|
||||
from app.schema_validation import validate
|
||||
from app.v2.notifications.notification_schemas import (
|
||||
get_notifications_request,
|
||||
@@ -13,6 +14,22 @@ from app.v2.notifications.notification_schemas import (
|
||||
)
|
||||
|
||||
|
||||
valid_get_json = {}
|
||||
|
||||
valid_get_with_optionals_json = {
|
||||
"reference": "test reference",
|
||||
"status": [NOTIFICATION_CREATED],
|
||||
"template_type": [EMAIL_TYPE],
|
||||
"include_jobs": "true",
|
||||
"older_than": "a5149c32-f03b-4711-af49-ad6993797d45"
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.parametrize("input", [valid_get_json, valid_get_with_optionals_json])
|
||||
def test_get_notifications_valid_json(input):
|
||||
assert validate(input, get_notifications_request) == input
|
||||
|
||||
|
||||
@pytest.mark.parametrize('invalid_statuses, valid_statuses', [
|
||||
# one invalid status
|
||||
(["elephant"], []),
|
||||
|
||||
Reference in New Issue
Block a user