mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-24 01:11:38 -05:00
Remove letter_job_ids schema
This commit is contained in:
@@ -1,20 +1,3 @@
|
||||
from app.schema_validation.definitions import uuid
|
||||
|
||||
letter_job_ids = {
|
||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||
"description": "list of job ids",
|
||||
"type": "object",
|
||||
"title": "job_ids",
|
||||
"properties": {
|
||||
"job_ids": {"type": "array",
|
||||
"items": uuid,
|
||||
"minItems": 1
|
||||
},
|
||||
},
|
||||
"required": ["job_ids"]
|
||||
}
|
||||
|
||||
|
||||
letter_references = {
|
||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||
"description": "list of letter notification references",
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
import json
|
||||
import uuid
|
||||
|
||||
import pytest
|
||||
from jsonschema import ValidationError
|
||||
|
||||
from app.letters.letter_schemas import letter_job_ids
|
||||
from app.schema_validation import validate
|
||||
|
||||
|
||||
def test_letter_job_id_retuns_400_if_array_is_empty():
|
||||
with pytest.raises(ValidationError) as e:
|
||||
validate({"job_ids": []}, letter_job_ids)
|
||||
error = json.loads(str(e.value))
|
||||
assert len(error.keys()) == 2
|
||||
assert error.get('errors')[0]['message'] == 'job_ids [] is too short'
|
||||
|
||||
|
||||
def test_letter_job_id_retuns_400_if_array_doesnot_contain_uuids():
|
||||
with pytest.raises(ValidationError) as e:
|
||||
validate({"job_ids": ["1", "2"]}, letter_job_ids)
|
||||
error = json.loads(str(e.value))
|
||||
assert len(error.keys()) == 2
|
||||
assert error.get('errors')[0]['message'] == 'job_ids is not a valid UUID'
|
||||
|
||||
|
||||
def test_letter_job():
|
||||
ids_ = {"job_ids": [str(uuid.uuid4()), str(uuid.uuid4())]}
|
||||
j = validate(ids_, letter_job_ids)
|
||||
assert j == ids_
|
||||
Reference in New Issue
Block a user