aletrn commited on
Commit
5af10a7
1 Parent(s): 2d0111c

[test] update test cases because of renamed/new types

Browse files
Files changed (1) hide show
  1. tests/io/test_lambda_helpers.py +5 -5
tests/io/test_lambda_helpers.py CHANGED
@@ -3,7 +3,7 @@ import time
3
  from http import HTTPStatus
4
  from unittest.mock import patch
5
  from src.io.lambda_helpers import get_parsed_bbox_points, get_parsed_request_body, get_response
6
- from src.utilities.type_hints import RawRequestInput
7
  from src.utilities import utilities
8
  from tests import TEST_EVENTS_FOLDER
9
 
@@ -51,7 +51,7 @@ def test_get_parsed_bbox_other_inputs():
51
  for json_filename in ["single_rectangle", "multi_prompt"]:
52
  with open(TEST_EVENTS_FOLDER / f"get_parsed_bbox_prompts_{json_filename}.json") as tst_json:
53
  inputs_outputs = json.load(tst_json)
54
- parsed_input = RawRequestInput.model_validate(inputs_outputs["input"])
55
  output = get_parsed_bbox_points(parsed_input)
56
  assert output == inputs_outputs["output"]
57
 
@@ -76,15 +76,15 @@ def test_get_parsed_request_body():
76
  "zoom": 10, "source_type": "Satellite", "debug": True
77
  }
78
  output = get_parsed_request_body(input_event["event"])
79
- assert output == RawRequestInput.model_validate(input_event["event"])
80
 
81
  input_event_str = json.dumps(input_event["event"])
82
  output = get_parsed_request_body(input_event_str)
83
- assert output == RawRequestInput.model_validate(expected_output_dict)
84
 
85
  event = {"body": utilities.base64_encode(input_event_str).decode("utf-8")}
86
  output = get_parsed_request_body(event)
87
- assert output == RawRequestInput.model_validate(expected_output_dict)
88
 
89
 
90
  def test_get_url_tile():
 
3
  from http import HTTPStatus
4
  from unittest.mock import patch
5
  from src.io.lambda_helpers import get_parsed_bbox_points, get_parsed_request_body, get_response
6
+ from src.utilities.type_hints import ApiRequestBody
7
  from src.utilities import utilities
8
  from tests import TEST_EVENTS_FOLDER
9
 
 
51
  for json_filename in ["single_rectangle", "multi_prompt"]:
52
  with open(TEST_EVENTS_FOLDER / f"get_parsed_bbox_prompts_{json_filename}.json") as tst_json:
53
  inputs_outputs = json.load(tst_json)
54
+ parsed_input = ApiRequestBody.model_validate(inputs_outputs["input"])
55
  output = get_parsed_bbox_points(parsed_input)
56
  assert output == inputs_outputs["output"]
57
 
 
76
  "zoom": 10, "source_type": "Satellite", "debug": True
77
  }
78
  output = get_parsed_request_body(input_event["event"])
79
+ assert output == ApiRequestBody.model_validate(input_event["event"])
80
 
81
  input_event_str = json.dumps(input_event["event"])
82
  output = get_parsed_request_body(input_event_str)
83
+ assert output == ApiRequestBody.model_validate(expected_output_dict)
84
 
85
  event = {"body": utilities.base64_encode(input_event_str).decode("utf-8")}
86
  output = get_parsed_request_body(event)
87
+ assert output == ApiRequestBody.model_validate(expected_output_dict)
88
 
89
 
90
  def test_get_url_tile():