def test_string_url(self): """LIVETRANSLATION_JQUERY is a string, use as the jQuery URL""" with patch_settings(LIVETRANSLATION_JQUERY=u"/jquery.js"): pattern, url = process_jquery_setting() self.assertEqual(url, "/jquery.js")
def test_default_url(self): """LIVETRANSLATION_JQUERY == None -> default URL""" with patch_settings(LIVETRANSLATION_JQUERY=None): pattern, url = process_jquery_setting() self.assertEqual(url, "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js")
def test_string_pattern(self): """LIVETRANSLATION_JQUERY is a string, base pattern on it""" with patch_settings(LIVETRANSLATION_JQUERY=u"/jquery.js"): pattern, url = process_jquery_setting() self.assertEqual(pattern, ur'<script\s[^>]*src="\/jquery\.js"')
def test_none_pattern(self): """LIVETRANSLATION_JQUERY == None -> pattern == None""" with patch_settings(LIVETRANSLATION_JQUERY=None): pattern, url = process_jquery_setting() self.assertEqual(pattern, None)