Пример #1
0
    def test_basic8(self):
        
        from gf.rejuice.rejuice_script import replace_url

        f = cStringIO.StringIO("p {background: #ffffff url(\"alma/korte.jpg\") no-repeat right top}")
        n = cStringIO.StringIO()
        res = replace_url('/this1/infile.css', f, n, 'xxxprefix/') 
        self.assertEqual(n.getvalue(), "p {background: #ffffff url(xxxprefix/korte.jpg) no-repeat right top}\n")
        self.assertEqual(res, {'/this1/alma/korte.jpg': 'korte.jpg'})
Пример #2
0
    def test_basic6(self):
        
        from gf.rejuice.rejuice_script import replace_url

        f = cStringIO.StringIO("p {background: #ffffff url(alma/korte.jpg) no-repeat right top;} b {background: #ffffff url(korte/korte.jpg) no-repeat right top;}\n .header {background: #ffffff url(alma/eper.jpg) no-repeat right top;} .footer {background: #ffffff url(korte/banan.jpg) no-repeat right top;}")
        n = cStringIO.StringIO()
        res = replace_url('/this1/infile.css', f, n, 'xxxprefix/') 
        self.assertEqual(n.getvalue(), "p {background: #ffffff url(xxxprefix/korte.jpg) no-repeat right top;} b {background: #ffffff url(xxxprefix/korte_1.jpg) no-repeat right top;}\n .header {background: #ffffff url(xxxprefix/eper.jpg) no-repeat right top;} .footer {background: #ffffff url(xxxprefix/banan.jpg) no-repeat right top;}\n")
        self.assertEqual(res, {'/this1/alma/korte.jpg': 'korte.jpg', '/this1/korte/korte.jpg': 'korte_1.jpg', '/this1/alma/eper.jpg': 'eper.jpg', '/this1/korte/banan.jpg': 'banan.jpg'})