MCPcopy Index your code
hub / github.com/MongoEngine/mongoengine / test_validation

Method test_validation

tests/fields/test_url_field.py:8–20  ·  view source on GitHub ↗

Ensure that URLFields validate urls properly.

(self)

Source from the content-addressed store, hash-verified

6
7class 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."""

Callers

nothing calls this directly

Calls 2

LinkClass · 0.70
validateMethod · 0.45

Tested by

no test coverage detected