def parsed_items(): freezer = freeze_time('2018-11-07') freezer.start() spider = ChiSsa42Spider() res = file_response('files/chi_ssa_42.html') minutes_res = file_response('files/chi_ssa_42_minutes.html') parsed_items = [item for item in spider._parse_items(res, upcoming=True) ] + [item for item in spider._parse_items(minutes_res)] freezer.stop() return parsed_items
def test_location(item): spider = ChiSsa42Spider() assert item['location'] == spider.location
from datetime import date, time import pytest from freezegun import freeze_time from tests.utils import file_response from city_scrapers.constants import COMMISSION, CONFIRMED, PASSED from city_scrapers.spiders.chi_ssa_42 import ChiSsa42Spider freezer = freeze_time('2018-11-07') freezer.start() spider = ChiSsa42Spider() res = file_response('files/chi_ssa_42.html') minutes_res = file_response('files/chi_ssa_42_minutes.html') parsed_items = [item for item in spider._parse_items(res, upcoming=True) ] + [item for item in spider._parse_items(minutes_res)] freezer.stop() def test_start(): assert parsed_items[0]['start'] == { 'date': date(2018, 11, 8), 'time': time(18, 30), 'note': '' } assert parsed_items[1]['start'] == { 'date': date(2018, 9, 20), 'time': time(18, 30), 'note': '', }