def test_export_sessions_none_csv(self):
        """Method to check sessions data export with no abstract"""

        with self.app.test_request_context():
            test_session = SessionSubFactory()
            test_session.long_abstract = None
            test_session.level = None
            self._test_export_session_csv(test_session)
    def _test_export_session_csv(self, test_session=None):
        with self.app.test_request_context():
            if not test_session:
                test_session = SessionSubFactory()
            field_data = export_sessions_csv([test_session])
            session_row = field_data[1]

            assert session_row[0] == 'example (accepted)'
            assert session_row[12] == 'accepted'
def get_room_session_stream(db, user=None, **kwargs):
    stream = VideoStreamFactoryBase(**kwargs)
    room = MicrolocationSubVideoStreamFactory(video_stream=stream)
    session = SessionSubFactory(microlocation=room, event=room.event)
    if user:
        role, _ = get_or_create(Role, name='owner', title_name='Owner')
        UsersEventsRoles(user=user, event=room.event, role=role)
    db.session.commit()

    return room, stream, session
Exemplo n.º 4
0
def get_session(db, user, event_owner=False, **kwargs):
    new_user = UserFactory(is_admin=False, is_verified=False)

    if event_owner:
        owner = user
        creator = new_user
    else:
        owner = new_user
        creator = user
    session = SessionSubFactory(creator_id=creator.id, **kwargs)
    role, _ = get_or_create(Role, name='owner', title_name='Owner')
    UsersEventsRoles(user=owner, event=session.event, role=role)
    db.session.commit()

    return session
def get_event(db):
    event = EventFactoryBasic(
        starts_at="2199-10-01T1:00:00+00:00", ends_at="2199-10-10T1:00:00+00:00"
    )

    SessionSubFactory(
        event=event,
        starts_at="2199-10-02T1:00:00+00:00",
        ends_at="2199-10-02T1:00:30+00:00",
    )
    SessionSubFactory(
        event=event,
        starts_at="2199-10-02T1:05:00+00:00",
        ends_at="2199-10-02T1:05:30+00:00",
    )
    SessionSubFactory(
        event=event,
        starts_at="2199-10-04T1:00:00+00:00",
        ends_at="2199-10-04T1:00:30+00:00",
    )

    db.session.commit()

    return event
Exemplo n.º 6
0
def get_minimal_session(db, user):
    session = SessionSubFactory(
        subtitle=None,
        level=None,
        language=None,
        short_abstract=None,
        slides_url=None,
        state=None,
        is_locked=False,
        creator_id=user.id,
    )
    SpeakersCallSubFactory(event=session.event)
    db.session.commit()

    return session
    def test_export_sessions_with_details_csv(self):
        """Method to check that sessions details are correct"""

        with self.app.test_request_context():
            test_session = SessionSubFactory(
                short_abstract='short_abstract',
                long_abstract='long_abstract',
                comments='comment',
                level='level',
                created_at=common.date_,
                average_rating=common.average_rating_,
                rating_count=common.rating_count_,
            )
            db.session.commit()
            field_data = export_sessions_csv([test_session])
            session_row = field_data[1]

            assert session_row == \
                [
                    'example (accepted)',
                    test_session.starts_at.astimezone(
                        pytz.timezone(test_session.event.timezone)
                    ).strftime('%B %-d, %Y %H:%M %z'),
                    test_session.ends_at.astimezone(
                        pytz.timezone(test_session.event.timezone)
                    ).strftime('%B %-d, %Y %H:%M %z'),
                    '',
                    '',
                    common.string_,
                    'short_abstract',
                    'long_abstract',
                    'comment',
                    session_row[9],
                    'Yes',
                    'level',
                    'accepted',
                    '',
                    '',
                    'English',
                    common.url_,
                    common.url_,
                    common.url_,
                    common.average_rating_,
                    common.rating_count_,
                ]
def test_export_basic(db):
    test_session = SessionSubFactory(
        title='Gooseberry Muffin',
        event__name='Hoopa Loopa',
        event__identifier='asdfgh',
        event__location_name='Narnia',
    )
    db.session.commit()
    test_cal_str = to_ical(test_session.event, include_sessions=True)
    test_cal = icalendar.Calendar.from_ical(test_cal_str)

    event = test_cal.subcomponents[0]
    assert event['summary'] == 'Hoopa Loopa'
    assert event['url'] == 'http://eventyay.com/e/asdfgh'
    assert event['location'] == 'Narnia'

    session = test_cal.subcomponents[1]
    assert session['summary'] == 'Gooseberry Muffin'
    assert session['url'] == f'http://eventyay.com/e/asdfgh/session/{test_session.id}'

    assert ICalExporter.export(test_session.event_id) == test_cal_str
Exemplo n.º 9
0
def session(db):
    session = SessionSubFactory()
    session.creator = UserFactory()
    create_owner(db, session.event)

    return session
Exemplo n.º 10
0
def test_session_site_link(db):
    session = SessionSubFactory(event__identifier='abcde', id=34567)
    db.session.commit()

    assert session.event.site_link == 'http://eventyay.com/e/abcde'
    assert session.site_link == 'http://eventyay.com/e/abcde/session/34567'