Skip to content

Commit

Permalink
Added unittests for prolific_utils and base_api_resource
Browse files Browse the repository at this point in the history
  • Loading branch information
meta-paul committed Aug 16, 2023
1 parent dc84680 commit 7313137
Show file tree
Hide file tree
Showing 6 changed files with 900 additions and 509 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def _base_request(

elif method == HTTPMethod.DELETE:
response = requests.delete(url, headers=headers, json=params)

else:
raise ProlificException("Invalid HTTP method.")

Expand All @@ -103,6 +104,10 @@ def _base_request(

return result

except ProlificException:
# Reraise these errors further to avoid catching them in the latest `except` condition
raise

except requests.exceptions.HTTPError as err:
logger.error(
f"{log_prefix} Request error: {err}. Response text: `{err.response.text}`"
Expand Down
1 change: 1 addition & 0 deletions mephisto/abstractions/providers/prolific/api/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# LICENSE file in the root directory of this source tree.

# 2xx
HTTP_200_OK = 200
HTTP_204_NO_CONTENT = 204

# 4xx
Expand Down
5 changes: 5 additions & 0 deletions test/abstractions/providers/prolific/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env python3

# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
5 changes: 5 additions & 0 deletions test/abstractions/providers/prolific/api/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env python3

# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
Loading

0 comments on commit 7313137

Please sign in to comment.