/
test_woolworths.py
88 lines (68 loc) · 3.32 KB
/
test_woolworths.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
77
78
79
80
81
82
83
84
85
86
87
88
from responses import GET
from recipe_scrapers.woolworths import Woolworths
from tests import ScraperTest
class TestWoolworthsScraper(ScraperTest):
scraper_class = Woolworths
@property
def expected_requests(self):
yield GET, "https://www.woolworths.com.au/shop/recipes/asparagus-salad-with-lemon-vinaigrette", "tests/test_data/woolworths.testhtml"
yield GET, "https://foodhub.woolworths.com.au/content/woolworths-foodhub/en/asparagus-salad-with-lemon-vinaigrette.model.json", "tests/test_data/woolworths.testhtml"
def test_host(self):
self.assertEqual("woolworths.com.au", self.harvester_class.host())
def test_author(self):
self.assertEqual("Fresh Ideas", self.harvester_class.author())
def test_category(self):
self.assertEqual("Salads", self.harvester_class.category())
def test_title(self):
self.assertEqual(
"Asparagus Salad With Lemon Vinaigrette Recipe | Woolworths",
self.harvester_class.title(),
)
def test_total_time(self):
self.assertEqual(15, self.harvester_class.total_time())
def test_prep_time(self):
self.assertEqual(10, self.harvester_class.prep_time())
def test_yields(self):
self.assertEqual("4 servings", self.harvester_class.yields())
def test_image(self):
self.assertEqual(
"https://foodhub.scene7.com/is/image/woolworthsltdprod/2010-asparagus-salad-with-lemon-vinaigrette:Square-1300x1300",
self.harvester_class.image(),
)
def test_ingredients(self):
self.assertEqual(
[
"2 bunches asparagus, trimmed, halved diagonally",
"100g snow peas, trimmed, halved diagonally",
"2 gem lettuce, trimmed, leaves separated",
"2 radishes, trimmed, thinly sliced into rounds",
"80g feta, crumbled",
"0.5 cup small basil leaves",
"2 tbs natural sliced almonds, toasted",
"1 tbs white wine vinegar",
"2 tsp Dijon mustard",
"0.25 tsp sea salt flakes",
"0.25 tsp caster sugar",
"0.25 cup extra virgin olive oil",
],
self.harvester_class.ingredients(),
)
def test_instructions(self):
self.assertEqual(
"""Bring a medium saucepan of water to the boil over high heat. Cook asparagus and snow peas for 2 minutes or until just tender. Drain. Refresh under cold water. Drain.
Meanwhile, to make the vinaigrette, whisk all the ingredients together in a small jug until combined, then season.
Arrange lettuce, asparagus, snow peas and radish on a platter. Scatter over feta, drizzle with dressing, top with basil and almonds, then serve.""",
self.harvester_class.instructions(),
)
def test_cuisine(self):
self.assertEqual("French", self.harvester_class.cuisine())
def test_cook_time(self):
self.assertEqual(5, self.harvester_class.cook_time())
def test_nutrients(self):
self.assertEqual({}, self.harvester_class.nutrients())
def test_language(self):
self.assertEqual("en-AU", self.harvester_class.language())
def test_site_name(self):
self.assertEqual(
"Woolworths | Fresh Ideas For You", self.harvester_class.site_name()
)