diff --git a/gourmet/plugins/import_export/website_import_plugins/foodnetwork_plugin.py b/gourmet/plugins/import_export/website_import_plugins/foodnetwork_plugin.py
index a81ee7d0d..21dcc12cc 100644
--- a/gourmet/plugins/import_export/website_import_plugins/foodnetwork_plugin.py
+++ b/gourmet/plugins/import_export/website_import_plugins/foodnetwork_plugin.py
@@ -8,13 +8,14 @@ class FoodNetworkPlugin (PluginPlugin):
def test_url (self, url, data):
if 'foodnetwork.com' in url:
return 5
+ return 0
def get_importer (self, webpage_importer):
class FoodNetworkParser (webpage_importer.MenuAndAdStrippingWebParser):
imageexcluders = [re.compile('foodnetworkstore|googlead|ft-|banner')]
-
+
def preparse (self):
headm = re.compile('rcp-head.*')
textm = re.compile('body-text.*')
@@ -51,4 +52,3 @@ def preparse (self):
webpage_importer.MenuAndAdStrippingWebParser.preparse(self)
return FoodNetworkParser
-
diff --git a/gourmet/plugins/import_export/website_import_plugins/ica_se_plugin.py b/gourmet/plugins/import_export/website_import_plugins/ica_se_plugin.py
index dc7c212b9..aaebe0aa2 100644
--- a/gourmet/plugins/import_export/website_import_plugins/ica_se_plugin.py
+++ b/gourmet/plugins/import_export/website_import_plugins/ica_se_plugin.py
@@ -6,7 +6,7 @@
class Excluder(object):
def __init__(self, url):
- self.url=url
+ self.url = url
def search(self, other_url):
return not (other_url.endswith(self.url))
@@ -19,6 +19,7 @@ def test_url (self, url, data):
"Is this url from ica.se"
if 'ica.se' in url:
return 5
+ return 0
def get_importer (self, webpage_importer):
diff --git a/gourmet/plugins/import_export/website_import_plugins/tests/test_foodnetwork_plugin.html b/gourmet/plugins/import_export/website_import_plugins/tests/test_foodnetwork_plugin.html
new file mode 100644
index 000000000..7b550119f
--- /dev/null
+++ b/gourmet/plugins/import_export/website_import_plugins/tests/test_foodnetwork_plugin.html
@@ -0,0 +1,2471 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Pan-Roasted Chicken with Oranges and Rosemary Recipe
+
+
+
+
Pan-Roasted Chicken with Oranges and Rosemary
+
+ Recipe courtesy Aida Mollenkamp
+
Show: Ask Aida Episode: Chicken
+
+
+
Recipe categories: Fruit , Oranges , Meat , Poultry , Chicken ,
+
+
+
+
+
+
+
+
+
+
+
1 Video | Photo: Pan-Roasted Chicken with Oranges and Rosemary Recipe
+
+
+
+
+ Ingredients
+
+
+ 5 tablespoons olive oil
+ 6 tablespoons rosemary leaves
+ 1 tablespoon kosher salt
+ 2 teaspoons red pepper flakes
+ 3/4 teaspoon freshly ground black pepper
+ 4 pounds chicken thighs and drumsticks (6 thighs and 6 drumsticks)
+ 1/2 medium orange, cut into 6 very thin slices and slices cut into half moons
+ 1 tablespoon unsalted butter
+
+
+
Directions
+
+
Heat oven to 450 degrees F and arrange rack in middle.
+
In a large bowl, mix together 1/4 cup of the oil, rosemary, salt, red pepper flakes, and freshly ground black pepper. Add chicken pieces and turn to coat well. Slip 1 piece of orange under skin of each piece.
+
Heat remaining 1 tablespoon olive oil and butter in a cast iron skillet or large frying pan over medium-high heat until butter foams. Working in batches, add 3 or 4 chicken pieces (don't overcrowd the pan) and brown on both sides until skin is crisp and golden, about 2 to 3 minutes per batch. As chicken is finished, place in a 13 by 9-inch baking dish.
+
Once all chicken has browned, place in oven to roast until juices run clear when pricked with a knife and meat registers 160 to 165 degrees F on an instant-read thermometer, about 20 to 25 minutes. Let rest 5 minutes before serving.
+
+
+
+
+
+
+ Print Recipe
+
+
+
+
+
+
+
Browse Similar Recipes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
See More Recipes Like This From Food.com
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Free Recipe of the Day Newsletter
+
+
+
+
+
+
+
+
+
+
+
+
+
Ads by Google
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
More From Food Network
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/gourmet/plugins/import_export/website_import_plugins/tests/test_foodnetwork_plugin.py b/gourmet/plugins/import_export/website_import_plugins/tests/test_foodnetwork_plugin.py
new file mode 100644
index 000000000..80dd0c74b
--- /dev/null
+++ b/gourmet/plugins/import_export/website_import_plugins/tests/test_foodnetwork_plugin.py
@@ -0,0 +1,61 @@
+# encoding: utf-8
+import unittest
+import BeautifulSoup
+
+from gourmet.plugins.import_export.website_import_plugins import foodnetwork_plugin
+
+class DummyImporter(object):
+ class MenuAndAdStrippingWebParser(object):
+ pass
+
+
+class TestFoodnetworkPlugin(unittest.TestCase):
+
+ url = "http://www.foodnetwork.com/recipes/ask-aida/pan-roasted-chicken-with-oranges-and-rosemary-recipe/index.html"
+
+ def _read_html(self):
+ filename = __file__.rsplit(".", 1)[0]+".html"
+ return (open(filename).read())
+
+ def setUp(self):
+ self.text = self._read_html()
+ self.plugin = foodnetwork_plugin.FoodNetworkPlugin()
+
+ def test_url(self):
+ self.assertEqual(self.plugin.test_url(self.url, self.text), 5)
+ self.assertEqual(self.plugin.test_url("http://www.foodnetwork.com/rec", self.text), 5)
+ self.assertEqual(self.plugin.test_url("http://foodnetwork.com/rec", self.text), 5)
+ self.assertEqual(self.plugin.test_url("http://www.foodnetwork.com", self.text), 5)
+ self.assertEqual(self.plugin.test_url("http://www.foodnetwork.net", self.text), 0)
+ self.assertEqual(self.plugin.test_url("http://google.com", self.text), 0)
+
+ def test_parse(self):
+ # Setup
+ parser = self.plugin.get_importer(DummyImporter)()
+ parser.soup = BeautifulSoup.BeautifulSoup(self.text,
+ convertEntities=BeautifulSoup.BeautifulStoneSoup.XHTML_ENTITIES,
+ )
+ # Do the parsing
+ parser.preparse()
+ # Pick apart results
+ result = parser.preparsed_elements
+
+ ingredients = [r for r in result if r[1] == "ingredients"][0][0]
+ ingredients = [i for i in ingredients if type(i) == BeautifulSoup.Tag]
+ name = [r for r in result if r[1] == "title"][0][0][0].text
+ instructions = [r for r in result if r[1] == "recipe"][0][0].text
+
+ # Check results
+ self.assertEqual(len(ingredients), 8)
+
+ self.assertTrue('Pan-Roasted Chicken with Oranges and Rosemary' in name)
+
+ self.assertTrue('Heat oven to 450 degrees F and arrange rack in middle.' in instructions)
+ self.assertTrue('Let rest 5 minutes before serving.' in instructions)
+
+ self.assertFalse('You must be logged in to review this recipe.' in instructions)
+
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/gourmet/plugins/import_export/website_import_plugins/tests/test_ica_se_plugin.html b/gourmet/plugins/import_export/website_import_plugins/tests/test_ica_se_plugin.html
new file mode 100644
index 000000000..30f2b5321
--- /dev/null
+++ b/gourmet/plugins/import_export/website_import_plugins/tests/test_ica_se_plugin.html
@@ -0,0 +1,1009 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Grillad kyckling med melon | Recept ICA.se
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Du verkar ha en gammal webbläsare. Uppdatera för att få ut det mesta av ICA.se.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/gourmet/plugins/import_export/website_import_plugins/tests/test_ica_se_plugin.py b/gourmet/plugins/import_export/website_import_plugins/tests/test_ica_se_plugin.py
new file mode 100644
index 000000000..387e4447f
--- /dev/null
+++ b/gourmet/plugins/import_export/website_import_plugins/tests/test_ica_se_plugin.py
@@ -0,0 +1,67 @@
+# encoding: utf-8
+import unittest
+import BeautifulSoup
+
+from gourmet.plugins.import_export.website_import_plugins import ica_se_plugin
+
+class DummyImporter(object):
+ class WebParser(object):
+ pass
+
+
+class TestIcaPlugin(unittest.TestCase):
+ def test_excluder(self):
+ url = "/src/doc/"
+ excluder = ica_se_plugin.Excluder(url)
+
+ self.assertTrue(excluder.search(url+"index.html"))
+ self.assertTrue(excluder.search("index.html"))
+ self.assertFalse(excluder.search(url))
+ self.assertFalse(excluder.search("http://ica.se/"+url))
+
+
+ url = "http://www.ica.se/recept/grillad-kyckling-med-melon-712641/"
+
+ def _read_html(self):
+ filename = __file__.rsplit(".", 1)[0]+".html"
+ return (open(filename).read())
+
+ def setUp(self):
+ self.text = self._read_html()
+ self.plugin = ica_se_plugin.IcaSePlugin()
+
+ def test_url(self):
+ self.assertEqual(self.plugin.test_url(self.url, self.text), 5)
+ self.assertEqual(self.plugin.test_url("http://www.ica.se/rec", self.text), 5)
+ self.assertEqual(self.plugin.test_url("http://ica.se/rec", self.text), 5)
+ self.assertEqual(self.plugin.test_url("http://ica.com/", self.text), 0)
+ self.assertEqual(self.plugin.test_url("http://google.com", self.text), 0)
+
+ def test_parse(self):
+ # Setup
+ parser = self.plugin.get_importer(DummyImporter)()
+ parser.soup = BeautifulSoup.BeautifulSoup(self.text,
+ convertEntities=BeautifulSoup.BeautifulStoneSoup.XHTML_ENTITIES,
+ )
+ # Do the parsing
+ parser.preparse()
+ # Pick apart results
+ result = parser.preparsed_elements
+
+ ingredients = [r for r in result if r[1] == "ingredients"]
+ name = [r for r in result if r[1] == "recipe"][0][0].text
+ instructions = [r for r in result if r[1] == "instructions"][0][0].text
+ # Check results
+ self.assertEqual(len(ingredients), 9)
+
+ self.assertTrue('Grillad kyckling med melon' in name)
+
+ print type(instructions)
+ self.assertTrue('Dela varje kycklinglårfilé i 2 bitar.' in instructions,
+ instructions)
+ self.assertTrue('Ta upp dem och skölj ur pannan.' in instructions)
+ self.assertTrue('Fri från gluten, laktos, mjölkprotein och ägg.' in instructions)
+
+
+if __name__ == '__main__':
+ unittest.main()
Review This Recipe
+You must be logged in to review this recipe.
+- Log In
+or Sign Up to Review
+Newest Ratings and Reviews
+ +Read all 33 reviews
+ + ++ + +-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+ You must provide a reason for flagging this review.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ people found this review Helpful.
+
+
+
+ Was this review helpful to you?
+ Yes |
+ No
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+ You must provide a reason for flagging this review.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ people found this review Helpful.
+
+
+
+ Was this review helpful to you?
+ Yes |
+ No
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+ You must provide a reason for flagging this review.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ people found this review Helpful.
+
+
+
+ Was this review helpful to you?
+ Yes |
+ No
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + +By CrisNoelle
+ + +on August 11, 2012
+ +Flag
+ + + +Flag This Review?
Please provide the reason why you think this review is inappropriate.
+ ++ + +- Submit
or Cancel
This recipe is a BIG family favorite at my house. For a more orange taste I added fresh orange juice and orange zest to the marinade. Also don't forget to add the left over marinade to the chicken before finishing it in the oven, don't want to waste a single drop of that delicious nectar!!! It turns into a type of glaze, really good on potatoes, be they roasted, mashed, or boiled! Bon Appetit fellow foodies!
+ + + +By Chef Celine
+ + +Highlands Ranch, CO
on May 18, 2012
+ +Flag
+ + + +Flag This Review?
Please provide the reason why you think this review is inappropriate.
+ ++ + +- Submit
or Cancel
We absolutely loved this recipe! I highly recommend it!!!
+ + + +By xapikleia3_5135376
+ + +Corona, CA
on March 20, 2012
+ +Flag
+ + + +Flag This Review?
Please provide the reason why you think this review is inappropriate.
+ ++ + +- Submit
or Cancel
My family loves this recipe! I'm not really sure that I understand the negative comments, because I think the ingredients all come through wonderfully. The only change I make is that I do two slices of orange for each piece of chicken.
+ + + +The sauteed-then-baked skin is divine!
Read all 33 reviews
+