Ensure that URLFields validate urls properly.
(self)
| 6 | |
| 7 | class TestURLField(MongoDBTestCase): |
| 8 | def test_validation(self): |
| 9 | """Ensure that URLFields validate urls properly.""" |
| 10 | |
| 11 | class Link(Document): |
| 12 | url = URLField() |
| 13 | |
| 14 | link = Link() |
| 15 | link.url = "google" |
| 16 | with pytest.raises(ValidationError): |
| 17 | link.validate() |
| 18 | |
| 19 | link.url = "http://www.google.com:8080" |
| 20 | link.validate() |
| 21 | |
| 22 | def test_unicode_url_validation(self): |
| 23 | """Ensure unicode URLs are validated properly.""" |