Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unittests for Prolific integration (2) #1047

Merged
merged 2 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def _base_request(

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

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

Expand All @@ -102,6 +103,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}`")
if err.response.status_code == status.HTTP_401_UNAUTHORIZED:
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
2 changes: 2 additions & 0 deletions mephisto/abstractions/providers/prolific/prolific_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,8 @@ def add_workers_to_qualification(
)
raise

return None


def give_worker_qualification(
client: ProlificClient,
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
Loading