Example #1
0
def test_weekly_generation():
    row = [
        'Gregory Mitchell', '773.731.7777',
        'https://www.gregmitchell7thward.org/', '7', 'Bridget Newsham', 'Yes',
        '2249 E 95th St. Chicago ', 'Weekly', 'Monday', '3:00 PM', '7:00 PM',
        'No', '', 'First come first served '
    ]

    spider = WardNightSpider()
    spider.start_date = date(2017, 10, 31)
    events = spider._parse_row(row)

    assert events[0]['start_time'].isoformat() == '2017-11-06T15:00:00-06:00'
    assert events[0]['end_time'].isoformat() == '2017-11-06T19:00:00-06:00'
    assert events[0]['id'] == 'ward_night/201711061500/x/ward_night_ward_7'

    assert events[1]['start_time'].isoformat() == '2017-11-13T15:00:00-06:00'
    assert events[1]['end_time'].isoformat() == '2017-11-13T19:00:00-06:00'
    assert events[1]['id'] == 'ward_night/201711131500/x/ward_night_ward_7'

    assert events[2]['start_time'].isoformat() == '2017-11-20T15:00:00-06:00'
    assert events[2]['end_time'].isoformat() == '2017-11-20T19:00:00-06:00'
    assert events[2]['id'] == 'ward_night/201711201500/x/ward_night_ward_7'
Example #2
0
def test_monthly_generation():
    row = [
        'Leslie Hairston', '773.324.5555', 'http://leslieahairston.com/', '5',
        'Bridget Newsham', 'Yes', 'Rotating locations',
        'Monthly (4th occurrence)', 'Tuesday', '6:00 PM', '8:00 PM', '', '',
        'Every fourth Tuesday, no meeting in November or December, group meetings rather than one-on-one'
    ]

    spider = WardNightSpider()
    spider.start_date = date(2017, 10, 31)
    events = spider._parse_row(row)

    assert events[0]['start_time'].isoformat() == '2017-11-28T18:00:00-06:00'
    assert events[0]['end_time'].isoformat() == '2017-11-28T20:00:00-06:00'
    assert events[0]['id'] == 'ward_night/201711281800/x/ward_night_ward_5'

    assert events[1]['start_time'].isoformat() == '2017-12-26T18:00:00-06:00'
    assert events[1]['end_time'].isoformat() == '2017-12-26T20:00:00-06:00'
    assert events[1]['id'] == 'ward_night/201712261800/x/ward_night_ward_5'

    assert events[2]['start_time'].isoformat() == '2018-01-23T18:00:00-06:00'
    assert events[2]['end_time'].isoformat() == '2018-01-23T20:00:00-06:00'
    assert events[2]['id'] == 'ward_night/201801231800/x/ward_night_ward_5'