def test_invalid_scheme(self): with self.assertRaises(ValidationError): validate_editor('javascript:alert(0)') with self.assertRaises(ValidationError): validate_editor('javaScript:alert(0)') with self.assertRaises(ValidationError): validate_editor(' javaScript:alert(0)')
def test_valid(self): self.assertIsNone( validate_editor('editor://open/?file=%(file)s&line=%(line)s'))
def test_empty(self): self.assertIsNone(validate_editor(''))
def test_valid(self): self.assertIsNone( validate_editor('editor://open/?file=%(file)s&line=%(line)s') )
def test_no_scheme(self): with self.assertRaises(ValidationError): validate_editor('./local/url')
def test_invalid_format(self): with self.assertRaises(ValidationError): validate_editor('editor://open/?file=%(fle)s&line=%(line)s')