def test_export_speakers_csv(self):
        """Method to check speakers data export"""

        with self.app.test_request_context():
            test_speaker = SpeakerFactory(name='Mario Behling',
                                          mobile='9004345009',
                                          short_biography='Speaker Bio',
                                          organisation='FOSSASIA',
                                          position='position',
                                          speaking_experience='1',
                                          sponsorship_required='No',
                                          city='Berlin',
                                          country='Germany')
            user = create_user(email='*****@*****.**', password='******')
            user.id = 2
            field_data = export_speakers_csv([test_speaker])
            speaker_row = field_data[1]
            self.assertEqual(speaker_row[0], 'Mario Behling')
            self.assertEqual(speaker_row[1], '*****@*****.**')
            self.assertEqual(speaker_row[2], '')
            self.assertEqual(speaker_row[3], '9004345009')
            self.assertEqual(speaker_row[4], 'Speaker Bio')
            self.assertEqual(speaker_row[5], 'FOSSASIA')
            self.assertEqual(speaker_row[6], 'position')
            self.assertEqual(speaker_row[7], '1')
            self.assertEqual(speaker_row[8], 'No')
            self.assertEqual(speaker_row[9], 'Berlin')
            self.assertEqual(speaker_row[10], 'Germany')
            self.assertEqual(speaker_row[11], common.url_)
            self.assertEqual(speaker_row[12], common.url_)
            self.assertEqual(speaker_row[13], common.url_)
            self.assertEqual(speaker_row[14], common.url_)
            self.assertEqual(speaker_row[15], common.url_)
    def test_export_speakers_csv(self):
        """Method to check speakers data export"""

        with app.test_request_context():
            test_speaker = SpeakerFactory()
            user = create_user(email='*****@*****.**', password='******')
            user.id = 2
            field_data = export_speakers_csv([test_speaker])
            self.assertEqual(field_data[1][0], common.string_)
            self.assertEqual(field_data[1][1], '*****@*****.**')
Exemplo n.º 3
0
    def test_export_subcomponents(self):
        """Test to check presence of subcomponents"""
        with self.app.test_request_context():
            test_session = SessionFactory()

            speaker = SpeakerFactory(name="xyz",
                                     email="*****@*****.**",
                                     user_id=1)
            test_session.speakers = [speaker]

            test_cal = icalendar.Calendar.from_ical(ICalExporter().export(
                test_session.event_id))

            cal_content_lines = test_cal.content_lines()
            self.assertIn(
                'URL:http://localhost/v1/events?identifier={}'.format(
                    test_session.event.identifier), cal_content_lines)
            self.assertIn('LOCATION:example', cal_content_lines)
            self.assertIn('ATTENDEE;CN=xyz:MAILTO:[email protected]',
                          cal_content_lines)