class TestHundredAndOneCookbooksScraper(unittest.TestCase):
    def setUp(self):
        # tests are run from tests.py
        with open(
                os.path.join(os.getcwd(), 'recipe_scrapers', 'tests',
                             'test_data', '101cookbooks.html')) as file_opened:
            self.harvester_class = HundredAndOneCookbooks(file_opened,
                                                          test=True)

    def test_host(self):
        self.assertEqual('101cookbooks.com', self.harvester_class.host())

    def test_title(self):
        self.assertEqual(self.harvester_class.title(),
                         "Nikki's Healthy Cookies Recipe")

    def test_total_time(self):
        self.assertEqual(0, self.harvester_class.total_time())

    def test_ingredients(self):
        self.assertListEqual([
            '3 large, ripe bananas,  well mashed (about 1 1/2 cups)',
            '1 teaspoon vanilla extract',
            "1/4 cup coconut oil, barely warm - so it isn't solid (or alternately, olive oil)",
            '2 cups rolled oats', '2/3 cup almond meal',
            '1/3 cup coconut, finely shredded & unsweetened',
            '1/2 teaspoon cinnamon', '1/2 teaspoon fine grain sea salt',
            '1 teaspoon baking powder',
            '6 - 7 ounces chocolate chips or dark chocolate bar chopped'
        ], self.harvester_class.ingredients())

    def test_instructions(self):
        return self.assertEqual(
            "Preheat oven to 350 degrees, racks in the top third.\nIn a large bowl combine the bananas, vanilla extract, and coconut oil. Set aside. In another bowl whisk together the oats, almond meal, shredded coconut, cinnamon, salt, and baking powder. Add the dry ingredients to the wet ingredients and stir until combined. Fold in the chocolate chunks/chips.The dough is a bit looser than a standard cookie dough, don't worry about it. Drop dollops of the dough, each about 2 teaspoons in size, an inch apart, onto a parchment (or Silpat) lined baking sheet. Bake for 12 - 14 minutes. I baked these as long as possible without burning the bottoms and they were perfect - just shy of 15 minutes seems to be about right in my oven.\nMakes about 3 dozen bite-sized cookies.\nPrint Recipe",
            self.harvester_class.instructions())
class TestHundredAndOneCookbooksScraper(unittest.TestCase):
    def setUp(self):
        # tests are run from tests.py
        with open(os.path.join(
            os.getcwd(),
            'recipe_scrapers',
            'tests',
            'test_data',
            '101cookbooks.html'
        )) as file_opened:
            self.harvester_class = HundredAndOneCookbooks(file_opened, test=True)

    def test_host(self):
        self.assertEqual(
            '101cookbooks.com',
            self.harvester_class.host()
        )

    def test_title(self):
        self.assertEqual(
            self.harvester_class.title(),
            "Nikki's Healthy Cookies Recipe"
        )

    def test_total_time(self):
        self.assertEqual(
            0,
            self.harvester_class.total_time()
        )

    def test_ingredients(self):
        self.assertListEqual(
            [
                '3 large, ripe bananas,  well mashed (about 1 1/2 cups)',
                '1 teaspoon vanilla extract',
                "1/4 cup coconut oil, barely warm - so it isn't solid (or alternately, olive oil)",
                '2 cups rolled oats',
                '2/3 cup almond meal',
                '1/3 cup coconut, finely shredded & unsweetened',
                '1/2 teaspoon cinnamon',
                '1/2 teaspoon fine grain sea salt',
                '1 teaspoon baking powder',
                '6 - 7 ounces chocolate chips or dark chocolate bar chopped'
            ],
            self.harvester_class.ingredients()
        )

    def test_instructions(self):
        return self.assertEqual(
            "Preheat oven to 350 degrees, racks in the top third.\nIn a large bowl combine the bananas, vanilla extract, and coconut oil. Set aside. In another bowl whisk together the oats, almond meal, shredded coconut, cinnamon, salt, and baking powder. Add the dry ingredients to the wet ingredients and stir until combined. Fold in the chocolate chunks/chips.The dough is a bit looser than a standard cookie dough, don't worry about it. Drop dollops of the dough, each about 2 teaspoons in size, an inch apart, onto a parchment (or Silpat) lined baking sheet. Bake for 12 - 14 minutes. I baked these as long as possible without burning the bottoms and they were perfect - just shy of 15 minutes seems to be about right in my oven.\nMakes about 3 dozen bite-sized cookies.\nPrint Recipe",
            self.harvester_class.instructions()
        )
class TestHundredAndOneCookbooksScraper(unittest.TestCase):
    def setUp(self):
        # tests are run from tests.py
        with open(
                os.path.join(os.getcwd(), 'recipe_scrapers', 'tests',
                             'test_data',
                             '101cookbooks.testhtml')) as file_opened:
            self.harvester_class = HundredAndOneCookbooks(file_opened,
                                                          test=True)

    def test_host(self):
        self.assertEqual('101cookbooks.com', self.harvester_class.host())

    def test_title(self):
        self.assertEqual(self.harvester_class.title(),
                         "Curried Tomato Tortellini Soup")

    def test_total_time(self):
        self.assertEqual(0, self.harvester_class.total_time())

    def test_ingredients(self):
        self.assertEqual(
            "4  big handfuls spinach, chopped (or frozen equiv) "
            "2 tablespoons extra virgin olive oil"
            "1  medium yellow onion, diced"
            "3 cloves garlic, minced"
            "2 1/2 teaspoons curry powder"
            "3/4 teaspoon sweet (or smoked) paprika"
            "1/2 teaspoon ground turmeric"
            "3/4 teaspoon red chile flakes"
            "1 28- ounce can whole tomatoes, with liquid"
            "3/4 cup dried red lentils, rinsed"
            "4 cups water"
            "1 teaspoon fine grain sea salt, plus more to taste"
            "8 ounces / 1/2 pound fresh tortellini"
            "to serve: a bit of grated cheese, lemon (optional)",
            self.harvester_class.ingredients())

    def test_instructions(self):
        return self.assertEqual(
            "If you're using frozen spinach, set it on the counter to thaw a bit. In the meantime, heat the olive oil in a large pot over medium-high heat. Stir in the onion and cook, stirring occasionally, for 5 minutes or so, until the onion has softened a bit. Stir in the garlic, wait a minute, then add the curry powder, paprika, turmeric, and chile flakes, and stir well. ",
            "Break up the tomatoes with your hands as you add them to the pot along with the tomato liquid, stir in the lentils, and the water. Cover and allow to cook for 15 minutes or so, until the lentils have cooked through. Stir in the salt, and then the tortellini. Cover and cook for another 3-5 minutes, or per package instructions - until tender and cooked through. Stir in the spinach bring back to a simmer, and serve with a dusting of cheese and a squeeze of lemon juice. If you need to thin out with a bit more water, do so, and re-season. Enjoy!",
            self.harvester_class.instructions())
Example #4
0
class TestHundredAndOneCookbooksScraper(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',
                             '101cookbooks.testhtml')) as file_opened:
            self.harvester_class = HundredAndOneCookbooks(file_opened,
                                                          test=True)

    def test_host(self):
        self.assertEqual('101cookbooks.com', self.harvester_class.host())

    def test_title(self):
        self.assertEqual(self.harvester_class.title(),
                         "Blood Orange Gin Sparkler")

    def test_total_time(self):
        self.assertEqual(15, self.harvester_class.total_time())

    def test_yields(self):
        self.assertEqual("1 serving(s)", self.harvester_class.yields())

    def test_image(self):
        self.assertEqual(
            'https://images.101cookbooks.com/gin_sparkler.jpg?w=680',
            self.harvester_class.image())

    def test_ingredients(self):
        self.assertCountEqual([
            '2 cups / 480 ml water', '1 cup / 6.5 oz / 185 g sugar',
            '4 tablespoons (~2 sprigs-worth) fresh rosemary leaves',
            '1 bay leaf (optional)', 'blood oranges', 'gin', 'ice cubes',
            'tonic water (or sparkling water)'
        ], self.harvester_class.ingredients())

    def test_instructions(self):
        return self.assertEqual(
            "Combine the water, sugar, rosemary, and bay in a small saucepan over medium heat. Bring to a simmer for 3-5 minutes, or long enough for the sugar to dissolve, stirring occasionally. Remove from the heat and let infuse for 10 minutes. Strain into a jar to cool completely.\nIn the meantime, juice and strain your oranges, you'll need 3 tablespoons / 1.5 ounces of juice for each drink.\nTo make each drink you're going to combine equal parts gin, juice, and tonic water with a bit of syrup and ice. So, its 3 tablespoons / 1 1/2 oz gin, 3 tablespoons / 1 1/2 oz freshly squeezed blood orange juice, and 1-2 teaspoons of the rosemary syrup in each tall glass (I used kolsch glasses here). Stir to combine, fill each glass 2/3 full with ice and top off with 3 tablespoons / 1 1/2 oz tonic water. Stir again and you're set.",
            self.harvester_class.instructions())