Exemplo n.º 1
0
 def test_replace_url(self):
     input_string = "https://www.youtube.com/watch?v=q06xDugyxiw&list=PLp-wjw6lssYmrRD6jb2mMhpAYg8_kyS7-&index=19"
     expected = "this_is_a_file.ttf"
     output = css_downloader.replace_url(input_string,
                                         ("https://www.youtube.com/watch?v=q06xDugyxiw&list="
                                          "PLp-wjw6lssYmrRD6jb2mMhpAYg8_kyS7-&index=19"),
                                         "this_is_a_file.ttf")
     self.assertEqual(expected, output)
     expected = "this_is_a_file.wopr"
     output = css_downloader.replace_url(input_string,
                                         ("https://www.youtube.com/watch?v=q06xDugyxiw&list="
                                          "PLp-wjw6lssYmrRD6jb2mMhpAYg8_kyS7-&index=19"),
                                         "this_is_a_file.wopr")
     self.assertEqual(expected, output)
Exemplo n.º 2
0
 def test_replace_url_multiline(self):
     input_string = """
     @font-face {
     font-family: 'Roboto Condensed';
     font-style: normal;
     font-weiht: 400;
     src: local('Roboto Condensed'), local('RobotoCondensed-Regular'),
     url(http://fonts.gstatic.com/s/robotocondensed/v13/Zd2E9abXLFGSr9G3YK2MsDR-eWpsHSw83BRsAQElGgc.ttf) format('truetype');
     }"""
     expected = """
     @font-face {
     font-family: 'Roboto Condensed';
     font-style: normal;
     font-weiht: 400;
     src: local('Roboto Condensed'), local('RobotoCondensed-Regular'),
     url(this_is_a_file.ttf) format('truetype');
     }"""
     output = css_downloader.replace_url(input_string,
                                         ("http://fonts.gstatic.com/s/robotocondensed/v13/"
                                          "Zd2E9abXLFGSr9G3YK2MsDR-eWpsHSw83BRsAQElGgc.ttf"),
                                         "this_is_a_file.ttf")
     self.assertEqual(expected, output)