'Check basic URL field validation on model forms'

def test_url_on_modelform(self):

    self.assertFalse(HomepageForm({u'url': u'foo'}).is_valid())
    self.assertFalse(HomepageForm({u'url': u'http://'}).is_valid())
    self.assertFalse(HomepageForm({u'url': u'http://example'}).is_valid())
    self.assertFalse(HomepageForm({u'url': u'http://example.'}).is_valid())
    self.assertFalse(HomepageForm({u'url': u'http://com.'}).is_valid())
    self.assertTrue(HomepageForm({u'url': u'http://localhost'}).is_valid())
    self.assertTrue(HomepageForm({u'url': u'http://example.com'}).is_valid())
    self.assertTrue(HomepageForm({u'url': u'http://www.example.com'}).is_valid())
    self.assertTrue(HomepageForm({u'url': u'http://www.example.com:8000'}).is_valid())
    self.assertTrue(HomepageForm({u'url': u'http://www.example.com/test'}).is_valid())
    self.assertTrue(HomepageForm({u'url': u'http://www.example.com:8000/test'}).is_valid())
    self.assertTrue(HomepageForm({u'url': u'http://example.com/foo/bar'}).is_valid())
