from datetime import datetime
from os.path import dirname, join

import pytest
from city_scrapers_core.constants import BOARD, PASSED
from city_scrapers_core.utils import file_response

from city_scrapers.spiders.det_wrecking_examiners import DetWreckingExaminersSpider

test_response = file_response(
    join(dirname(__file__), "files", "det_wrecking_examiners.html"),
    url=(
        'https://www.detroitmi.gov/government/boards/board-wrecking-contractors-examiners/board-wrecking-contractors-meetings'  # noqa
    ))
spider = DetWreckingExaminersSpider()
parsed_items = [item for item in spider.parse(test_response)]


def test_title():
    assert parsed_items[0][
        'title'] == 'Board of Wrecking Contractors Examiners'


def test_description():
    assert parsed_items[0]['description'] == ''


def test_start():
    assert parsed_items[0]['start'] == datetime(2018, 2, 14, 13)

import datetime

import pytest
from tests.utils import file_response

from city_scrapers.spiders.det_wrecking_examiners import DetWreckingExaminersSpider

test_response = file_response(
    'files/det_wrecking_examiners.html',
    'https://www.detroitmi.gov/government/boards/board-wrecking-contractors-examiners/board-wrecking-contractors-meetings'  # noqa
)
spider = DetWreckingExaminersSpider()
parsed_items = [
    item for item in spider.parse(test_response) if isinstance(item, dict)
]


def test_name():
    assert parsed_items[0]['name'] == 'Board of Wrecking Contractors Examiners'


def test_description():
    assert parsed_items[0]['event_description'] == ''


def test_start():
    assert parsed_items[0]['start'] == {
        'date': datetime.date(2018, 2, 14),
        'time': datetime.time(13, 0),
        'note': ''
    }