Beispiel #1
0
 def test_correct_html(self):
     with patch('sainsburys_cl.main.get_html') as mock_get_html:
         with open('sainsburys_cl/test/test_product_details.html') as test_html:
             html = test_html.read()
             html_size = len(html)
             expected = {'title': 'Testing gizmo',
                         'size': html_size,
                         'unit_price': 999,
                         'description': 'So much gizmo.'}
             mock_get_html.return_value = (BeautifulSoup(html, HTML_PARSER),
                                           html_size)
         assert(product_details('') == expected)
Beispiel #2
0
 def test_empty_html(self):
     assert(product_details('') == {})