Exemplo n.º 1
0
 def test_correct_url_with_redirect(self):
     mtv = ModelToValidate(
         number=10,
         name='Some Name',
         url_verify='http://qa-dev.w3.org/link-testsuite/http.php?code=301'
     )  #example.com is a redirect to iana.org now
     self.assertEqual(None, mtv.full_clean()
                      )  # This will fail if there's no Internet connection
Exemplo n.º 2
0
 def test_correct_url_value_passes(self):
     mtv = ModelToValidate(number=10, name="Some Name", url="http://www.djangoproject.com/")
     self.assertEqual(None, mtv.full_clean())  # This will fail if there's no Internet connection
Exemplo n.º 3
0
 def test_correct_email_value_passes(self):
     mtv = ModelToValidate(number=10, name="Some Name", email="*****@*****.**")
     self.assertEqual(None, mtv.full_clean())
Exemplo n.º 4
0
 def test_correct_FK_value_validates(self):
     parent = ModelToValidate.objects.create(number=10, name="Some Name")
     mtv = ModelToValidate(number=10, name="Some Name", parent_id=parent.pk)
     self.assertEqual(None, mtv.full_clean())
Exemplo n.º 5
0
 def test_with_correct_value_model_validates(self):
     mtv = ModelToValidate(number=10, name="Some Name")
     self.assertEqual(None, mtv.full_clean())
Exemplo n.º 6
0
 def test_correct_url_value_passes(self):
     mtv = ModelToValidate(number=10,
                           name='Some Name',
                           url='http://www.example.com/')
     self.assertEqual(None, mtv.full_clean()
                      )  # This will fail if there's no Internet connection
Exemplo n.º 7
0
 def test_correct_email_value_passes(self):
     mtv = ModelToValidate(number=10,
                           name='Some Name',
                           email='*****@*****.**')
     self.assertEqual(None, mtv.full_clean())
Exemplo n.º 8
0
 def test_correct_FK_value_validates(self):
     parent = ModelToValidate.objects.create(number=10, name='Some Name')
     mtv = ModelToValidate(number=10, name='Some Name', parent_id=parent.pk)
     self.assertEqual(None, mtv.full_clean())
Exemplo n.º 9
0
 def test_with_correct_value_model_validates(self):
     mtv = ModelToValidate(number=10, name='Some Name')
     self.assertEqual(None, mtv.full_clean())
Exemplo n.º 10
0
 def test_correct_url_value_passes(self):
     mtv = ModelToValidate(number=10, name='Some Name', url='http://www.example.com/')
     self.assertEqual(None, mtv.full_clean()) # This will fail if there's no Internet connection
Exemplo n.º 11
0
 def test_correct_url_with_redirect(self):
     mtv = ModelToValidate(number=10, name='Some Name', url_verify='http://qa-dev.w3.org/link-testsuite/http.php?code=301') #example.com is a redirect to iana.org now
     self.assertEqual(None, mtv.full_clean()) # This will fail if there's no Internet connection