-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#3889] Log outgoing requests, not log entries
- Loading branch information
Showing
6 changed files
with
70 additions
and
51 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
2 changes: 1 addition & 1 deletion
2
...events/timelinelog_details_view_admin.txt → ...tgoing_request_log_details_view_admin.txt
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,4 +1,4 @@ | ||
{% load i18n %} | ||
{% blocktrans trimmed with lead=log.fmt_lead user=log.fmt_user timelinelog=log.pk %} | ||
{{ lead }}: User {{ user }} viewed timelinelog {{ timelinelog }} in the admin | ||
{{ lead }}: User {{ user }} viewed outgoing request log {{ timelinelog }} in the admin | ||
{% endblocktrans %} |
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from django.urls import reverse | ||
from django.utils import timezone | ||
|
||
from django_webtest import WebTest | ||
from log_outgoing_requests.models import OutgoingRequestsLog | ||
from maykin_2fa.test import disable_admin_mfa | ||
|
||
from openforms.accounts.tests.factories import UserFactory | ||
from openforms.logging.models import TimelineLogProxy | ||
|
||
|
||
@disable_admin_mfa() | ||
class OutgoingRequestLogAdminTests(WebTest): | ||
def test_viewing_outgoing_request_log_details_in_admin_creates_log(self): | ||
user = UserFactory.create(is_superuser=True, is_staff=True) | ||
outgoing_request_log = OutgoingRequestsLog.objects.create( | ||
url="https://example.com", timestamp=timezone.now() | ||
) | ||
|
||
self.app.get( | ||
reverse( | ||
"admin:log_outgoing_requests_outgoingrequestslog_change", | ||
kwargs={"object_id": outgoing_request_log.id}, | ||
), | ||
user=user, | ||
) | ||
|
||
self.assertEqual( | ||
TimelineLogProxy.objects.filter( | ||
template="logging/events/outgoing_request_log_details_view_admin.txt" | ||
).count(), | ||
1, | ||
) |