Skip to content

Commit

Permalink
feat: modify comparison and formatting
Browse files Browse the repository at this point in the history
- compare json objects instead of response objects
- format the added lines of code
  • Loading branch information
Muhammad Faraz Maqsood committed Aug 1, 2024
1 parent 1fff44e commit afe87f8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
else:
SERVICE_HOST_V2 = 'http://localhost:8000'

PREFIX_V2 = SERVICE_HOST_V2 + '/api/v1'
PREFIX_V2 = SERVICE_HOST_V2 + '/forum/forum_proxy/api/v1'
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,23 @@ def perform_request(method, url, data_or_params=None, raw=False,
timeout=config.connection_timeout
)

if method == 'get':
if method == "get":
forum_v2_url = _get_forum_v2_url(url)
response_v2 = requests.request(
method,
forum_v2_url,
data=data,
params=params,
headers=headers,
timeout=config.connection_timeout
timeout=config.connection_timeout,
)
if response_v2 != response:
log.error(f"Forum v2 diff for endpoint {url} with params={params}. \
Expected: {response}. Got: {response_v2}.")
log.info(f"requested forum v1 url: {url}")
log.info(f"requested forum v2 url: {forum_v2_url}")
if response_v2.json() != response.json():
log.error(
f"Forum v2 difference, for endpoint {url} with params={params}. \
Expected: {response.json()}. Got: {response_v2.json()}."
)

metric_tags.append(f'status_code:{response.status_code}')
status_code = int(response.status_code)
Expand Down

0 comments on commit afe87f8

Please sign in to comment.