Beispiel #1
0
 def test_datetime(self):
     event = self.create_event()
     event.start_time = datetime(2014, 1, 25, 16)
     DBSession.flush()
     response = self.app.get('/v1/events', headers={'Accept': 'text/csv'})
     reader = csv.DictReader(StringIO(csv_text(response.text)))
     row = next(reader)
     self.assertEqual(row['start_time'], '2014-01-25T16:00:00')
Beispiel #2
0
    def test_location(self):
        self.create_event(title=u'Événement 1',
                          location=Location(name=u'Évian'))
        DBSession.flush()

        response = self.app.get('/v1/events', headers={'Accept': 'text/csv'})

        reader = csv.DictReader(StringIO(csv_text(response.text)))
        row = next(reader)
        self.assertEqual(row['location_name'], 'Évian')
        self.assertNotIn('location_event_id', row)
Beispiel #3
0
    def test_title(self):
        self.create_event(title=u'Événement 1')
        self.create_event(title=u'Événement 2')
        DBSession.flush()

        response = self.app.get('/v1/events', headers={'Accept': 'text/csv'})

        reader = csv.DictReader(StringIO(csv_text(response.text)))
        row = next(reader)
        self.assertIn('title', row)
        self.assertEqual(row['title'], 'Événement 1')
Beispiel #4
0
    def test_random_fields(self):
        self.create_event(title=u'Événement 1', press_contact_name=u'Émile')
        self.create_event(title=u'Événement 2', description=u'Foo bar')
        DBSession.flush()

        response = self.app.get('/v1/events', headers={'Accept': 'text/csv'})

        reader = csv.DictReader(StringIO(csv_text(response.text)))
        row = next(reader)
        self.assertEqual(row['press_contact_name'], 'Émile')
        row = next(reader)
        self.assertEqual(row['description'], u'Foo bar')
Beispiel #5
0
 def test_sounds(self):
     event = self.create_event()
     event.sounds = [
         Sound(url=u'http://example.com/sound1', license='CC BY'),
         Sound(url=u'http://example.com/sound2', license='Whatever'),
     ]
     DBSession.flush()
     response = self.app.get('/v1/events', headers={'Accept': 'text/csv'})
     reader = csv.DictReader(StringIO(csv_text(response.text)))
     row = next(reader)
     self.assertEqual(
         row['sounds'], u'http://example.com/sound1 (CC BY), ' +
         'http://example.com/sound2 (Whatever)')