Chromium Code Reviews| Index: src/caterpillar_test.py |
| diff --git a/src/caterpillar_test.py b/src/caterpillar_test.py |
| index 7ae50ff8e5beea0534d317deabb129782c30abbd..ff68bc3debf8f51f0ed282fd2ede4f1f97682a7f 100755 |
| --- a/src/caterpillar_test.py |
| +++ b/src/caterpillar_test.py |
| @@ -447,6 +447,46 @@ class TestInjectMiscTags(unittest.TestCase): |
| self.assertIsNotNone(meta) |
| self.assertEqual(meta['content'], chrome_app_manifest['name']) |
| + def test_no_head(self): |
| + """Tests that the manifest link tag is added even with no head.""" |
| + chrome_app_manifest = {} |
| + root_path = 'path' |
| + html = """ |
|
Matt Giuca
2016/01/29 02:19:26
"""\
Matthew Alger
2016/01/29 02:41:51
Done.
|
| +<!DOCTYPE html> |
| +<html> |
| + <body> |
| + <h1> |
| + Héllo, World! ÚÑÍ¢ÓÐÉ |
| + </h1> |
| + </body> |
| +</html>""" |
| + soup = bs4.BeautifulSoup(html, 'html.parser') |
| + caterpillar.inject_misc_tags(soup, chrome_app_manifest, root_path, '') |
| + link = soup.find('link', rel='manifest') |
|
Matt Giuca
2016/01/29 02:19:26
Again, I think you should match the entire file, n
Matthew Alger
2016/01/29 02:41:51
Done.
|
| + self.assertIsNotNone(link) |
| + self.assertEqual(link['href'], |
| + os.path.join(root_path, 'manifest.webmanifest')) |
| + self.assertIsNotNone(soup.find('head')) |
| + |
| + def test_no_head_or_html(self): |
| + """Tests that the manifest link tag is added with no head or html tags.""" |
| + chrome_app_manifest = {} |
| + root_path = 'path' |
| + html = """ |
| +<!DOCTYPE html> |
| +<body> |
| +<h1> |
| + Héllo, World! ÚÑÍ¢ÓÐÉ |
| +</h1> |
| +</body>""" |
| + soup = bs4.BeautifulSoup(html, 'html.parser') |
| + caterpillar.inject_misc_tags(soup, chrome_app_manifest, root_path, '') |
| + link = soup.find('link', rel='manifest') |
| + self.assertIsNotNone(link) |
| + self.assertEqual(link['href'], |
| + os.path.join(root_path, 'manifest.webmanifest')) |
| + self.assertIsNotNone(soup.find('head')) |
| + |
| class TestInsertTodosIntoFile(TestCaseWithTempDir): |
| """Tests insert_todos_into_file.""" |