-
-
Notifications
You must be signed in to change notification settings - Fork 311
/
Copy pathtest_chi_school_community_action_council.py
76 lines (51 loc) · 1.96 KB
/
test_chi_school_community_action_council.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
from datetime import datetime
from os.path import dirname, join
import pytest
from city_scrapers_core.constants import COMMITTEE
from city_scrapers_core.utils import file_response
from freezegun import freeze_time
from city_scrapers.spiders.chi_school_community_action_council import (
ChiSchoolCommunityActionCouncilSpider,
)
freezer = freeze_time("2020-08-06")
freezer.start()
test_response = file_response(
join(dirname(__file__), "files", "chi_school_community_action_council.html"),
url="https://www.cps.edu/services-and-supports/parent-engagement/community-action-councils-cacs/", # noqa
)
spider = ChiSchoolCommunityActionCouncilSpider()
parsed_items = [item for item in spider.parse(test_response)]
current_month_number = datetime.today().month
freezer.stop()
def test_num_items():
assert len(parsed_items) == (13 - current_month_number) * 8
def test_title():
assert parsed_items[0]["title"] == "Austin Community Action Council"
def test_start_time():
assert parsed_items[0]["start"] == datetime(2020, 8, 10, 17, 30)
def test_end_time():
assert parsed_items[0]["end"] is None
def test_id():
assert (
parsed_items[0]["id"]
== "chi_school_community_action_council/202008101730/x/austin_community_action_council" # noqa
)
def test_location():
assert parsed_items[0]["location"] == {
"name": "Michele Clark HS",
"address": "5101 W. Harrison St. Chicago, IL",
}
def test_source():
assert parsed_items[5]["source"] == "https://cacbronzeville.weebly.com/"
@pytest.mark.parametrize("item", parsed_items)
def test_links(item):
assert item["links"] == []
@pytest.mark.parametrize("item", parsed_items)
def test_description(item):
assert item["description"] == ""
@pytest.mark.parametrize("item", parsed_items)
def test_all_day(item):
assert item["all_day"] is False
@pytest.mark.parametrize("item", parsed_items)
def test_classification(item):
assert item["classification"] == COMMITTEE