Skip to content

Commit

Permalink
#280 Compare attachment content
Browse files Browse the repository at this point in the history
  • Loading branch information
viliambalaz committed Apr 25, 2022
1 parent dcc30c9 commit b1c19e1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions chcemvediet/apps/inforequests/tests/test_views/test_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# -*- coding: utf-8 -*-
import re
import mock
import unittest

from django.test import TestCase
from django.utils.translation import ugettext_lazy as _
Expand All @@ -19,7 +18,7 @@

class CreateViewTest(InforequestsTestCaseMixin, ViewTestCaseMixin, TestCase):
u"""
Tests ``create()`` view registered as "inforequests:create".
Tests ``inforequest_create()`` view registered as "inforequests:create".
"""

def _create_post_data(self, omit=(), **kwargs):
Expand Down Expand Up @@ -247,12 +246,11 @@ def test_post_with_draft_button_and_invalid_data_related_models_are_prefetched_b
with self.assertQueriesDuringRender(render_query_patterns.base):
response = self.client.post(reverse(u'inforequests:create'), data)

@unittest.skip(u'FIXME')
def test_post_with_submit_button_and_valid_data_creates_inforequest(self):
self._login_user(self.user1)
obligee = self._create_obligee(name=u'Obligee')
attachment1 = self._create_attachment(generic_object=self._get_session())
attachment2 = self._create_attachment(generic_object=self._get_session())
attachment1 = self._create_attachment(generic_object=self._get_session(), content=u'Plain text content')
attachment2 = self._create_attachment(generic_object=self._get_session(), content=u'<html><body>HTML content</body></html>')
data = self._create_post_data(button=u'submit', obligee=u'Obligee',
subject=[u'Subject'], content=[u'Content'],
attachments=u'%s,%s' % (attachment1.pk, attachment2.pk))
Expand All @@ -270,7 +268,9 @@ def test_post_with_submit_button_and_valid_data_creates_inforequest(self):
self.assertEqual(action.type, Action.TYPES.REQUEST)
self.assertIn(u'Subject', action.subject)
self.assertIn(u'Content', action.content)
self.assertItemsEqual(action.attachment_set.all(), [attachment1, attachment2])
attch1, attch2 = action.attachment_set.all()
self.assertEqual(attch1.content, attachment1.content)
self.assertEqual(attch2.content, attachment2.content)

def test_post_with_submit_button_and_valid_data_does_not_create_inforequest_if_exception_raised(self):
self._login_user(self.user1)
Expand Down

0 comments on commit b1c19e1

Please sign in to comment.