forked from hhursev/recipe-scrapers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_seriouseats.py
55 lines (46 loc) · 1.74 KB
/
test_seriouseats.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
import os
import unittest
from recipe_scrapers.seriouseats import SeriousEats
class TestSeriousEats(unittest.TestCase):
def setUp(self):
# tests are run from tests.py
with open(os.path.join(
os.path.dirname(os.path.realpath(__file__)),
'test_data',
'seriouseats.testhtml'
)) as file_opened:
self.harvester_class = SeriousEats(file_opened, test=True)
def test_host(self):
self.assertEqual(
'seriouseats.com',
self.harvester_class.host()
)
def test_title(self):
self.assertEqual(
self.harvester_class.title(),
'Homemade Preserved Horseradish Recipe'
)
def test_total_time(self):
self.assertEqual(
10,
self.harvester_class.total_time()
)
def test_yields(self):
self.assertEqual(
"1 item(s)",
self.harvester_class.yields()
)
def test_ingredients(self):
self.assertCountEqual(
[
'1 horseradish root, ends trimmed, peeled, cut into 1-inch chunks (see note)',
'Distilled white vinegar, for soaking',
'Kosher salt'
],
self.harvester_class.ingredients()
)
def test_instructions(self):
self.assertEqual(
'1. In a food processor or blender, process horseradish to fine shreds. Add enough vinegar to cover, then season with salt. If it tastes too pungent, add water, 1 tablespoon at a time, until the flavor is a little less harsh (though it should still be very strong and pungent). Keep refrigerated in an airtight container, up to 3 weeks.',
self.harvester_class.instructions()
)