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 a failing unit test to demonstrate issue #220 #221

Closed
wants to merge 1 commit into from
Closed
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
14 changes: 14 additions & 0 deletions report_builder/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1019,6 +1019,20 @@ def test_annotation_filter_max(self):

self.assertContains(response, data)

def test_missing_entries_with_foreign_key_fields(self):
parent = Person.objects.create(first_name='John', last_name='Doe')
parent2 = Person.objects.create(first_name='John', last_name='Doe')
Child.objects.create(first_name='John Jr. I', last_name='Doe', parent=parent)
Child.objects.create(first_name='John Jr. II', last_name='Doe', parent=parent2)
Child.objects.create(first_name='John Jr. III', last_name='Doe', parent=parent)

report = Report.objects.create(root_model=ContentType.objects.get_for_model(Child), name='children_report')
DisplayField.objects.create(report=report, field='id', field_verbose='stuff')
DisplayField.objects.create(report=report, field='id', path='parent__', field_verbose='stuff')

report_list = report.report_to_list()
self.assertEquals(len(report_list), 3, 'Not all children appear in the report.')


class ViewTests(TestCase):
def test_email_report_without_template(self):
Expand Down