'test export and import of ical'

def test_export_import(self):

    self._publishEvent(1)
    resp = self.app.get('/api/v1/events/1')
    identifier = json.loads(resp.data).get('identifier')
    resp = self.app.get(('/e/%s/schedule/calendar.ics' % identifier))
    self.assertEqual(resp.status_code, 200)
    self.assertIn('BEGIN:VEVENT', resp.data)
    self.assertIn('TestSpeaker', resp.data)
    resp = self._upload(resp.data, '/api/v1/events/import/ical', 'cal.ics')
    self.assertEqual(resp.status_code, 200)
    data = self.app.get('/api/v1/events/2').data
    self.assertIn('TestEvent', data)
    data = self.app.get('/api/v1/events/2/speakers').data
    self.assertIn('TestSpeaker', data)
