aboutsummaryrefslogtreecommitdiffstats
path: root/brevisurl/tests
diff options
context:
space:
mode:
authorVladimir Gorej2012-09-17 13:34:01 +0200
committerVladimir Gorej2012-09-17 13:34:01 +0200
commit5e37d36d5b8a241d458d54fa300ff3b7bfed8f5f (patch)
treeb3a010de1af7e3b4439fb9ecccfd2e7fefabe492 /brevisurl/tests
parenta99fc53d8ae3928ddb68bc3f2d6875f670c3cd1b (diff)
downloaddjango-brevisurl-5e37d36d5b8a241d458d54fa300ff3b7bfed8f5f.tar.bz2
Issue #13; using absurl util whenrever possible
Diffstat (limited to 'brevisurl/tests')
-rw-r--r--brevisurl/tests/test_utils.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/brevisurl/tests/test_utils.py b/brevisurl/tests/test_utils.py
index 3fedecd..a6a8fd2 100644
--- a/brevisurl/tests/test_utils.py
+++ b/brevisurl/tests/test_utils.py
@@ -1,7 +1,7 @@
from django.utils import unittest
from django.contrib.sites.models import Site
-from brevisurl.utils import load_object, absurl
+from brevisurl.utils import load_object, absurl, url_has_protocol
from brevisurl.backends.local import BrevisUrlBackend
@@ -51,4 +51,15 @@ class TestAbsUrl(unittest.TestCase):
def test_site_and_domain(self):
site = Site(domain='www.codescale.net', name='CodeScale.net')
abs_url = absurl(protocol='http', domain='sub.codescale.net', site=site, path='/')
- self.assertEqual(abs_url, 'http://sub.codescale.net/') \ No newline at end of file
+ self.assertEqual(abs_url, 'http://sub.codescale.net/')
+
+
+class TestUrlHasProtocol(unittest.TestCase):
+
+ def test_url_with_protocol(self):
+ url = 'http://test.sk'
+ self.assertTrue(url_has_protocol(url))
+
+ def test_url_without_protocol(self):
+ url = 'test.sk/path/'
+ self.assertFalse(url_has_protocol(url)) \ No newline at end of file