Ejemplo n.º 1
0
    def test_csv_import(self):

        user1 = User(
            mail="u1",
            first_name="First",
            last_name="User",
            password="",
            license="740020000001",
            phone="",
        )
        db.session.add(user1)
        db.session.commit()

        event = Event()

        output = StringIO(self.csv)

        events, processed, failed = csv_to_events(
            output, "{altitude}m-{denivele}m-{cotation}")
        event = events[0]
        assert processed == 1
        assert failed == []
        assert event.title == "Aiguille des Calvaires"
        assert event.num_slots == 8
        assert event.num_online_slots == 4
        assert "2322m-1200m-F" in event.rendered_description
        assert event.leaders[0].first_name == "First"
Ejemplo n.º 2
0
    def test_csv_import(self):

        create_test_user(user_license="740020000001")

        event = Event()

        output = StringIO(self.csv)
        events, processed, failed = csv_to_events(
            output, "{altitude}m-{denivele}m-{cotation}")
        assert len(events) == 1
        event = events[0]
        assert processed == 1
        assert not failed
        assert event.title == "Aiguille des Calvaires"
        assert event.num_slots == 8
        assert event.num_online_slots == 4
        assert event.registration_open_time == datetime.datetime(
            2021, 11, 19, 7, 0, 0)
        assert event.registration_close_time == datetime.datetime(
            2021, 11, 25, 12, 0, 0)
        assert "2322m-1200m-F" in event.rendered_description
        assert event.leaders[0].license == "740020000001"