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

Fixed #27218 -- Returned LogEntry instances from log_addition, log_change, log_deletion #7330

Conversation

francoisfreitag
Copy link
Contributor

Ticket: https://code.djangoproject.com/ticket/27218

This change makes it easier to alter a LogEntry in a custom ModelAdmin subclass overriding log_addition, log_change or log_deletion.

@@ -163,6 +163,26 @@ def test_logentry_unicode(self):
log_entry.action_flag = 4
self.assertEqual(six.text_type(log_entry), 'LogEntry Object')

def test_custom_log_actions(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is mostly for unit testing the LogEntry model, so I would limit the tests to LogEntryManager.log_action(). Similarly, could you try to unit test the ModelAdmin methods rather than having complete request/response tests? Maybe in tests/modeladmin.

p.s. when sending or updating a pull request, please also update the ticket as I just did.

@francoisfreitag francoisfreitag force-pushed the 27218/return_LogEntry_instances branch 4 times, most recently from 420a3e1 to 950e314 Compare October 3, 2016 00:38
# custom log actions behaviour ####################################
def test_custom_log_actions(self):
class BandAdmin(ModelAdmin):
def log_addition(self, request, object, message):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be enough to test that the default implementations return the LogEntry. You're indirectly testing it now by calling super() but the custom methods don't seem necessary.

@timgraham
Copy link
Member

merged in aa9569f, thanks!

@timgraham timgraham closed this Oct 4, 2016
@francoisfreitag francoisfreitag deleted the 27218/return_LogEntry_instances branch October 8, 2016 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants