def test_email_message(self):
     page_id = make_page_with_form(code='CODE')
     exporter = ConferenceExporter(page_id=page_id)
     message = exporter.create_email_message('from', ['to'])
     self.assertEqual(message.from_email, 'from')
     self.assertEqual(message.to, ['to'])
     self.assertEqual(len(message.attachments), 1)
 def test_email_message(self):
     page_id = make_page_with_form(code='CODE')
     exporter = ConferenceExporter(page_id=page_id)
     message = exporter.create_email_message('from', ['to'])
     self.assertEqual(message.from_email, 'from')
     self.assertEqual(message.to, ['to'])
     self.assertEqual(len(message.attachments), 1)
    def test_page_with_block_no_error(self):
        page_id = make_page_with_form()

        try:
            ConferenceExporter(page_id=page_id)
        except Exception:
            self.fail('valid page should not raise exception')
 def test_exporter_attendees(self):
     page_id = make_page_with_form(code='FOO')
     self.make_attendees(code='FOO', count=50)
     self.make_attendees(code='BAR', count=50)
     exporter = ConferenceExporter(page_id=page_id)
     self.assertEqual(exporter.count, 50)
     self.assertEqual(exporter.attendees.first().code, 'FOO')
Beispiel #5
0
 def test_prepare_field_to_row_unicode(self):
     attendee = mommy.prepare(
         ConferenceRegistration,
         organization=u'Citro\xebn'
     )
     self.assertEqual(
         ConferenceExporter.prepare_field(attendee, 'organization'),
         'Citro\xc3\xabn'
     )
Beispiel #6
0
 def test_prepare_field_to_row_sessions(self):
     attendee = mommy.prepare(
         ConferenceRegistration,
         sessions='["Morning", "Afternoon"]'
     )
     self.assertEqual(
         ConferenceExporter.prepare_field(attendee, 'sessions'),
         'Morning,Afternoon'
     )
 def test_csv(self):
     page_id = make_page_with_form(code='CODE')
     exporter = ConferenceExporter(page_id=page_id)
     csv = exporter.to_csv()
     self.assertEqual(len(csv.strip().split('\n')), 4)
 def test_exporter_at_capacity(self):
     page_id = make_page_with_form(code='FOO', capacity=100)
     self.make_attendees(code='FOO', count=100)
     exporter = ConferenceExporter(page_id=page_id)
     self.assertTrue(exporter.at_capacity)
 def test_exporter_conference_capacity(self):
     page_id = make_page_with_form(capacity=314159)
     exporter = ConferenceExporter(page_id=page_id)
     self.assertEqual(exporter.conference_capacity, 314159)
 def test_exporter_conference_code(self):
     page_id = make_page_with_form(code='foo')
     exporter = ConferenceExporter(page_id=page_id)
     self.assertEqual(exporter.conference_code, 'foo')
 def test_prepare_field_to_row_no_sessions(self):
     attendee = mommy.prepare(ConferenceRegistration, sessions='')
     self.assertEqual(
         ConferenceExporter.prepare_field(attendee, 'sessions'),
         ''
     )
    def test_page_no_form_raises_runtimeerror(self):
        page = BrowsePage(title='empty', slug='empty')
        revision = save_new_page(page)

        with self.assertRaises(RuntimeError):
            ConferenceExporter(page_id=revision.page_id)
 def test_no_page_raises_doesnotexist(self):
     with self.assertRaises(Page.DoesNotExist):
         ConferenceExporter(page_id=12345)
 def test_email_message_subject_at_capacity(self):
     page_id = make_page_with_form(capacity=0)
     exporter = ConferenceExporter(page_id=page_id)
     message = exporter.create_email_message('from', ['to'])
     self.assertIn('Full', message.subject)
 def test_email_message_subject_at_capacity(self):
     page_id = make_page_with_form(capacity=0)
     exporter = ConferenceExporter(page_id=page_id)
     message = exporter.create_email_message('from', ['to'])
     self.assertIn('Full', message.subject)
 def test_prepare_field_to_row_no_sessions(self):
     attendee = mommy.prepare(ConferenceRegistration, sessions='')
     self.assertEqual(
         ConferenceExporter.prepare_field(attendee, 'sessions'), '')
 def test_csv(self):
     page_id = make_page_with_form(code='CODE')
     exporter = ConferenceExporter(page_id=page_id)
     csv = exporter.to_csv()
     self.assertEqual(len(csv.strip().split('\n')), 4)