from datetime import datetime

from city_scrapers_core.constants import BOARD, COMMITTEE, TENTATIVE
from freezegun import freeze_time
from tests.utils import file_response

from city_scrapers.spiders.chi_city_college import ChiCityCollegeSpider

freezer = freeze_time('2018-01-12')
freezer.start()
test_response = file_response(
    'files/chi_city_college.html',
    'http://www.ccc.edu/events/Pages/March-2019-Board-and-Committee-Meetings.aspx'
)
spider = ChiCityCollegeSpider()
parsed_items = [item for item in spider.parse_event_page(test_response)]
freezer.stop()


def test_title():
    assert parsed_items[0][
        'title'] == 'Committee on Finance and Administrative Services'
    assert parsed_items[1]['title'] == 'Board of Trustees'


def test_start():
    assert parsed_items[0]['start'] == datetime(2019, 2, 7, 12, 0)


def test_end():
    assert parsed_items[0]['end'] is None
Esempio n. 2
0
from datetime import date, time

from tests.utils import file_response

from city_scrapers.constants import BOARD, PASSED
from city_scrapers.spiders.chi_city_college import ChiCityCollegeSpider

test_response = file_response('files/chi_city_college.html')
spider = ChiCityCollegeSpider()
item = spider.parse_event_page(test_response)


def test_name():
    assert item[
        'name'] == 'Board of Trustees: November 2018 Regular Board Meeting'


def test_start_time():
    assert item['start']['time'] == time(9, 0)
    assert item['start']['date'] == date(2018, 11, 1)
    assert item['start']['note'] is None


def test_end_time():
    assert item['end']['time'] == time(12, 0)
    assert item['end']['date'] == date(2018, 11, 1)
    assert item['end']['note'] is None


def test_id():
    assert item[
Esempio n. 3
0
from datetime import date, time

from freezegun import freeze_time
from tests.utils import file_response

from city_scrapers.constants import BOARD, COMMITTEE, TENTATIVE
from city_scrapers.spiders.chi_city_college import ChiCityCollegeSpider

freezer = freeze_time('2018-01-12')
freezer.start()
test_response = file_response(
    'files/chi_city_college.html',
    'http://www.ccc.edu/events/Pages/March-2019-Board-and-Committee-Meetings.aspx'
)
spider = ChiCityCollegeSpider()
parsed_items = [item for item in spider.parse_event_page(test_response) if isinstance(item, dict)]
freezer.stop()


def test_name():
    assert parsed_items[0]['name'] == 'Committee on Finance and Administrative Services'
    assert parsed_items[1]['name'] == 'Board of Trustees'


def test_start_time():
    assert parsed_items[0]['start']['time'] == time(12, 0)
    assert parsed_items[0]['start']['date'] == date(2019, 2, 7)
    assert parsed_items[0]['start']['note'] is None


def test_end_time():