Exemplo n.º 1
0
from datetime import date, time

import pytest
from freezegun import freeze_time
from tests.utils import file_response

from city_scrapers.constants import COMMITTEE
from city_scrapers.spiders.chi_transit import ChiTransitSpider

freezer = freeze_time('2018-01-01 12:00:00')
freezer.start()

test_response = file_response(
    'files/chi_transit.html', url='https://www.transitchicago.com/board/notices-agendas-minutes/'
)
spider = ChiTransitSpider()
parsed_items = [item for item in spider.parse(test_response) if isinstance(item, dict)]

freezer.stop()


def test_meeting_count():
    assert len(parsed_items) == 23


def test_unique_id_count():
    assert len(set([item['id'] for item in parsed_items])) == 23


def test_name():
    assert parsed_items[0]['name'] == 'Employee Retirement Review Committee Meeting'
Exemplo n.º 2
0
from datetime import datetime

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

from city_scrapers.spiders.chi_transit import ChiTransitSpider

freezer = freeze_time('2018-01-01 12:00:00')
freezer.start()

test_response = file_response(
    'files/chi_transit.html',
    url='https://www.transitchicago.com/board/notices-agendas-minutes/')
spider = ChiTransitSpider()
parsed_items = [item for item in spider.parse(test_response)]

freezer.stop()


def test_meeting_count():
    assert len(parsed_items) == 23


def test_unique_id_count():
    assert len(set([item['id'] for item in parsed_items])) == 23


def test_title():
    assert parsed_items[0][