Skip to content

Commit

Permalink
updated bbox list schema
Browse files Browse the repository at this point in the history
  • Loading branch information
Geary-Layne committed Nov 29, 2023
1 parent e951a7b commit 1aca932
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
8 changes: 6 additions & 2 deletions python/idsse_common/idsse/common/schema/das_web_request.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@
"type": "array",
"items": {
"type": "integer"
}
}
},
"minItems": 2,
"maxItems": 2
},
"minItems": 2,
"maxItems": 2
},

"DasWebRequest": {
Expand Down
20 changes: 16 additions & 4 deletions python/idsse_common/test/test_validate_das_web_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ def test_validate_das_web_request_message(das_web_request_validator: Validator,
assert False, f'Validate message raised an exception {exc}'


def test_validate_das_web_request_message_with_bbox_as_list(das_web_request_validator: Validator,
das_web_request_message: dict):
def test_validate_das_web_request_message_with_bbox_list(das_web_request_validator: Validator,
das_web_request_message: dict):
bbox = das_web_request_message.pop('bbox')
das_web_request_message['bbox'] = [bbox['botLeft'], bbox['topRight']]
try:
Expand All @@ -157,8 +157,20 @@ def test_validate_das_web_request_message_with_bbox_as_list(das_web_request_vali
assert False, f'Validate message raised an exception {exc}'


def test_validate_das_web_request_message_bad_bbox(das_web_request_validator: Validator,
das_web_request_message: dict):
def test_validate_das_web_request_message_bad_bbox_list(das_web_request_validator: Validator,
das_web_request_message: dict):
bbox = das_web_request_message.pop('bbox')
bot_left = bbox['botLeft']
top_right = bbox['topRight']
# move one value from bottom and adding to top, making neither represent a coordinate
top_right.append(bot_left.pop(1))
das_web_request_message['bbox'] = [bot_left, top_right]
with raises(ValidationError):
das_web_request_validator.validate(das_web_request_message)


def test_validate_das_web_request_message_bad_bbox_obj(das_web_request_validator: Validator,
das_web_request_message: dict):
# replace the bottom left int coordinate with a float
das_web_request_message['bbox']['botLeft'][0] = 1.2
with raises(ValidationError):
Expand Down

0 comments on commit 1aca932

Please sign in to comment.