-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[OSDEV-1117] Contribution record integration (#454)
Fix [OSDEV-1117](https://opensupplyhub.atlassian.net/browse/OSDEV-1117) 1. Connect `GET api/v1/moderation-events/{moderation_id}/`. 2. Connect `GET api/v1/production-locations?name={productionLocationName}&country={countryCode}&address={address}` to get potential matches using OpenSearch engine. 3. Connect `PATCH /v1/moderation-events/{moderation_id}/` (using for Reject button). 4. Connect `POST /v1/moderation-events/{moderation_id}/production-locations/` (using for Create New Location button). 5. Connect `PATCH /v1/moderation-events/{moderation_id}/production-locations/{os_id}/` (using for Confirm potential match button). 6. UI improvements: added toast component on moderation event update and backdrop to prevent accident clicks on other buttons while updation process. 7. Apply Django Signal for moderation-events index. 8. Update FE tests. 9. Add integration tests. [OSDEV-1117]: https://opensupplyhub.atlassian.net/browse/OSDEV-1117?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
- Loading branch information
1 parent
1155fa2
commit 9b95531
Showing
21 changed files
with
1,269 additions
and
429 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
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 |
---|---|---|
|
@@ -4,13 +4,21 @@ | |
|
||
class Command(BaseCommand): | ||
help = ('Usage: Create an API token for the user during the database ' | ||
'reset.') | ||
'reset, and set admin rights.') | ||
|
||
def handle(self, *args, **options): | ||
call_command('shell', | ||
'-c', | ||
("from rest_framework.authtoken.models import Token; " | ||
"from api.models import User; token = " | ||
"Token.objects.create(user=User.objects.get(id=2)," | ||
"key='1d18b962d6f976b0b7e8fcf9fcc39b56cf278051'); " | ||
"print('Token for [email protected]'); print(token)")) | ||
call_command( | ||
'shell', | ||
'-c', | ||
( | ||
"from rest_framework.authtoken.models import Token;" | ||
"from api.models import User;" | ||
"user = User.objects.get(id=2);" | ||
"user.is_staff = True;" | ||
"user.is_superuser = True;" | ||
"user.save();" | ||
"token = Token.objects.create(user=user," | ||
"key='1d18b962d6f976b0b7e8fcf9fcc39b56cf278051');" | ||
"print(f'Token for {user.email}: {token.key}')" | ||
) | ||
) |
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
from django.test import override_settings | ||
from django.utils.timezone import now | ||
from django.db.models.signals import post_save | ||
|
||
from rest_framework.test import APITestCase | ||
|
||
|
@@ -10,11 +11,20 @@ | |
from api.models.nonstandard_field import NonstandardField | ||
from api.models.source import Source | ||
|
||
from api.signals import moderation_event_update_handler_for_opensearch | ||
|
||
|
||
@override_settings(DEBUG=True) | ||
class BaseModerationEventsProductionLocationTest(APITestCase): | ||
def setUp(self): | ||
super().setUp() | ||
# Disconnect moderation event save propagation to | ||
# OpenSearch cluster, as it is outside the scope | ||
# of Django unit testing. | ||
post_save.disconnect( | ||
moderation_event_update_handler_for_opensearch, | ||
ModerationEvent | ||
) | ||
|
||
self.email = "[email protected]" | ||
self.password = "example123" | ||
|
Oops, something went wrong.