-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2572 Django 4 upgrade
- Loading branch information
Showing
75 changed files
with
2,437 additions
and
2,088 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.3.0 | ||
rev: v4.5.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-yaml | ||
- id: check-added-large-files | ||
- repo: https://github.com/psf/black | ||
rev: 22.6.0 | ||
rev: 24.3.0 | ||
hooks: | ||
- id: black |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -204,7 +204,7 @@ You can share a project with a user or multiple users by ``PUT`` a payload with | |
</pre> | ||
|
||
Example 1: Sharing with a specific user | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
:: | ||
|
||
curl -X PUT -d username=alice -d role=readonly https://api.ona.io/api/v1/projects/1/share | ||
|
@@ -215,8 +215,8 @@ Response | |
|
||
HTTP 204 NO CONTENT | ||
|
||
Example 2: Sharing with mutliple users | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
Example 2: Sharing with more than one user | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
:: | ||
|
||
curl -X PUT -d username=alice,jake -d role=readonly https://api.ona.io/api/v1/projects/1/share | ||
|
@@ -528,14 +528,14 @@ Example | |
^^^^^^^ | ||
|
||
:: | ||
|
||
curl -X GET https://api.ona.io/api/v1/projects/1/invitations | ||
|
||
Response | ||
^^^^^^^^ | ||
|
||
:: | ||
|
||
[ | ||
{ | ||
"id": 1, | ||
|
@@ -571,16 +571,16 @@ Example | |
^^^^^^^ | ||
|
||
:: | ||
|
||
curl -X GET https://api.ona.io/api/v1/projects/1/invitations?status=2 | ||
|
||
Response | ||
^^^^^^^^ | ||
|
||
:: | ||
|
||
[ | ||
|
||
{ | ||
"id": 2, | ||
"email":"[email protected]", | ||
|
@@ -604,7 +604,7 @@ Example | |
^^^^^^^ | ||
|
||
:: | ||
|
||
curl -X POST -d "[email protected]" -d "role=readonly" https://api.ona.io/api/v1/projects/1/invitations | ||
|
||
|
||
|
@@ -629,16 +629,16 @@ Response | |
^^^^^^^^ | ||
|
||
:: | ||
|
||
{ | ||
"id": 1, | ||
"email": "[email protected]", | ||
"role": "readonly", | ||
"status": 1, | ||
} | ||
|
||
The link embedded in the email will be of the format ``http://{url}`` | ||
|
||
The link embedded in the email will be of the format ``http://{url}`` | ||
where: | ||
|
||
- ``url`` - is the URL the recipient will be redirected to on clicking the link. The default is ``{domain}/api/v1/profiles`` where ``domain`` is domain where the API is hosted. | ||
|
@@ -667,14 +667,14 @@ Example | |
^^^^^^^ | ||
|
||
:: | ||
|
||
curl -X PUT -d "[email protected]" -d "role=editor" -d "invitation_id=1" https://api.ona.io/api/v1/projects/1/invitations/1 | ||
|
||
Response | ||
^^^^^^^^ | ||
|
||
:: | ||
|
||
{ | ||
"id": 1, | ||
"email": "[email protected]", | ||
|
@@ -696,19 +696,19 @@ Example | |
^^^^^^^ | ||
|
||
:: | ||
|
||
curl -X POST -d "invitation_id=6" https://api.ona.io/api/v1/projects/1/resend-invitation | ||
|
||
|
||
``invitation_id``: The primary key of the ``ProjectInvitation`` to resend. | ||
``invitation_id``: The primary key of the ``ProjectInvitation`` to resend. | ||
|
||
- Must be a ``ProjectInvitation`` whose status is **Pending** | ||
|
||
Response | ||
^^^^^^^^ | ||
|
||
:: | ||
|
||
{ | ||
"message": "Success" | ||
} | ||
|
@@ -727,18 +727,18 @@ Example | |
^^^^^^^ | ||
|
||
:: | ||
|
||
curl -X POST -d "invitation_id=6" https://api.ona.io/api/v1/projects/1/revoke-invitation | ||
|
||
``invitation_id``: The primary key of the ``ProjectInvitation`` to resend. | ||
``invitation_id``: The primary key of the ``ProjectInvitation`` to resend. | ||
|
||
- Must be a ``ProjectInvitation`` whose status is **Pending** | ||
|
||
Response | ||
^^^^^^^^ | ||
|
||
:: | ||
|
||
{ | ||
"message": "Success" | ||
} | ||
|
@@ -751,4 +751,4 @@ Since a project invitation is sent to an unregistered user, acceptance of the in | |
when `creating a new user <https://github.com/onaio/onadata/blob/main/docs/profiles.rst#register-a-new-user>`_. | ||
|
||
All pending invitations whose email match the new user's email will be accepted and projects shared with the | ||
user | ||
user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,12 +2,17 @@ | |
Test delete user management command. | ||
""" | ||
import sys | ||
from unittest import mock | ||
from six import StringIO | ||
from django.contrib.auth.models import User | ||
from unittest.mock import patch | ||
|
||
from django.contrib.auth import get_user_model | ||
from django.core.management import call_command | ||
from onadata.apps.main.tests.test_base import TestBase | ||
|
||
from six import StringIO | ||
|
||
from onadata.apps.api.management.commands.delete_users import get_user_object_stats | ||
from onadata.apps.main.tests.test_base import TestBase | ||
|
||
User = get_user_model() | ||
|
||
|
||
class DeleteUserTest(TestBase): | ||
|
@@ -35,7 +40,7 @@ def test_delete_users_with_input(self): | |
with self.assertRaises(User.DoesNotExist): | ||
User.objects.get(email="[email protected]") | ||
|
||
@mock.patch("onadata.apps.api.management.commands.delete_users.input") | ||
@patch("onadata.apps.api.management.commands.delete_users.input") | ||
def test_delete_users_no_input(self, mock_input): # pylint: disable=R0201 | ||
""" | ||
Test that when user_input is not provided, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.