Skip to content

Commit

Permalink
Merge pull request #604 from petrmifek/czech-translations-update
Browse files Browse the repository at this point in the history
Fix admin integration tests for the new "Import finished..." message
  • Loading branch information
shaggyfrog committed May 31, 2017
2 parents 26db40f + 7f87286 commit ad4ab2a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions import_export/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ def generate_log_entries(self, result, request):
def add_success_message(self, result, request):
opts = self.model._meta

success_message = _(u'Import finished, with {} new and ' \
u'{} updated {}.').format(result.totals[RowResult.IMPORT_TYPE_NEW],
success_message = _('Import finished, with {} new and ' \
'{} updated {}.').format(result.totals[RowResult.IMPORT_TYPE_NEW],
result.totals[RowResult.IMPORT_TYPE_UPDATE],
opts.verbose_name_plural)

Expand Down
12 changes: 9 additions & 3 deletions tests/core/tests/admin_integration_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from tablib import Dataset

from core.admin import BookAdmin, AuthorAdmin, BookResource
from core.models import Category, Parent
from core.models import Category, Parent, Book


class ImportExportAdminIntegrationTest(TestCase):
Expand Down Expand Up @@ -64,7 +64,10 @@ def test_import(self):
response = self.client.post('/admin/core/book/process_import/', data,
follow=True)
self.assertEqual(response.status_code, 200)
self.assertContains(response, _('Import finished, with 1 new book'))
self.assertContains(response,
_('Import finished, with {} new and {} updated {}.').format(
1, 0, Book._meta.verbose_name_plural)
)

@override_settings(TEMPLATE_STRING_IF_INVALID='INVALID_VARIABLE')
def test_import_mac(self):
Expand Down Expand Up @@ -98,7 +101,10 @@ def test_import_mac(self):
response = self.client.post('/admin/core/book/process_import/', data,
follow=True)
self.assertEqual(response.status_code, 200)
self.assertContains(response, _('Import finished, with 1 new book'))
self.assertContains(response,
_('Import finished, with {} new and {} updated {}.').format(
1, 0, Book._meta.verbose_name_plural)
)

def test_export(self):
response = self.client.get('/admin/core/book/export/')
Expand Down

0 comments on commit ad4ab2a

Please sign in to comment.