fix tests structure
This commit is contained in:
parent
6a59e4658e
commit
3534daf37d
@ -341,15 +341,30 @@ class FieldTest(MongoDBTestCase):
|
|||||||
person.validate()
|
person.validate()
|
||||||
|
|
||||||
def test_url_validation(self):
|
def test_url_validation(self):
|
||||||
"""Ensure that URLFields validate urls properly.
|
"""Ensure that URLFields validate urls properly."""
|
||||||
"""
|
|
||||||
class Link(Document):
|
class Link(Document):
|
||||||
url = URLField()
|
url = URLField()
|
||||||
|
|
||||||
|
Link.drop_collection()
|
||||||
|
|
||||||
|
link = Link()
|
||||||
|
link.url = 'google'
|
||||||
|
self.assertRaises(ValidationError, link.validate)
|
||||||
|
|
||||||
|
link.url = 'http://www.google.com:8080'
|
||||||
|
link.validate()
|
||||||
|
|
||||||
|
def test_unicode_url_validation(self):
|
||||||
|
"""Ensure unicode URLs are validated properly."""
|
||||||
|
class Link(Document):
|
||||||
|
url = URLField()
|
||||||
|
|
||||||
|
Link.drop_collection()
|
||||||
|
|
||||||
link = Link()
|
link = Link()
|
||||||
link.url = u'http://привет.com'
|
link.url = u'http://привет.com'
|
||||||
|
|
||||||
# TODO fix URL validation - this IS a valid URL
|
# TODO fix URL validation - this *IS* a valid URL
|
||||||
# For now we just want to make sure that the error message is correct
|
# For now we just want to make sure that the error message is correct
|
||||||
try:
|
try:
|
||||||
link.validate()
|
link.validate()
|
||||||
@ -360,18 +375,6 @@ class FieldTest(MongoDBTestCase):
|
|||||||
u"ValidationError (Link:None) (Invalid URL: http://\u043f\u0440\u0438\u0432\u0435\u0442.com: ['url'])"
|
u"ValidationError (Link:None) (Invalid URL: http://\u043f\u0440\u0438\u0432\u0435\u0442.com: ['url'])"
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_unicode_url_validation(self):
|
|
||||||
"""Ensure unicode URLs are validated properly."""
|
|
||||||
class Link(Document):
|
|
||||||
url = URLField()
|
|
||||||
|
|
||||||
link = Link()
|
|
||||||
link.url = 'google'
|
|
||||||
self.assertRaises(ValidationError, link.validate)
|
|
||||||
|
|
||||||
link.url = 'http://www.google.com:8080'
|
|
||||||
link.validate()
|
|
||||||
|
|
||||||
def test_url_scheme_validation(self):
|
def test_url_scheme_validation(self):
|
||||||
"""Ensure that URLFields validate urls with specific schemes properly.
|
"""Ensure that URLFields validate urls with specific schemes properly.
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user