aboutsummaryrefslogtreecommitdiffstats
path: root/brevisurl/tests
diff options
context:
space:
mode:
authorVladimir Gorej2012-09-17 15:04:01 +0200
committerVladimir Gorej2012-09-17 15:04:01 +0200
commite5091447bc204d730be7129be575516ab1acef91 (patch)
tree2c3b36110b5f2f0c71f191647dde1bfdb2305fe1 /brevisurl/tests
parent5e37d36d5b8a241d458d54fa300ff3b7bfed8f5f (diff)
downloaddjango-brevisurl-e5091447bc204d730be7129be575516ab1acef91.tar.bz2
Fixes for version 1.01.0
Diffstat (limited to 'brevisurl/tests')
-rw-r--r--brevisurl/tests/backends/test_local.py10
-rw-r--r--brevisurl/tests/test_utils.py15
2 files changed, 15 insertions, 10 deletions
diff --git a/brevisurl/tests/backends/test_local.py b/brevisurl/tests/backends/test_local.py
index 437c790..4577376 100644
--- a/brevisurl/tests/backends/test_local.py
+++ b/brevisurl/tests/backends/test_local.py
@@ -119,19 +119,13 @@ class TestLocalBrevisUrlBackend(TestCase):
brevisurl.settings.LOCAL_BACKEND_DOMAIN = _original_domain
def test_url_path_slash_stripping(self):
- _original_slash_strip = brevisurl.settings.LOCAL_BACKEND_STRIP_TOKEN_URL_SLASH
original_url = 'http://www.codescale.net/'
connection = get_connection('brevisurl.backends.local.BrevisUrlBackend', domain='http://test.com/d')
- brevisurl.settings.LOCAL_BACKEND_STRIP_TOKEN_URL_SLASH = True
short_url = connection.shorten_url(original_url)
self.assertRegexpMatches(short_url.shortened_url, r'^http://test\.com/d[^/]{5}$')
- brevisurl.settings.LOCAL_BACKEND_STRIP_TOKEN_URL_SLASH = _original_slash_strip
def test_url_path_slash_no_stripping(self):
- _original_slash_strip = brevisurl.settings.LOCAL_BACKEND_STRIP_TOKEN_URL_SLASH
original_url = 'http://www.codescale.net/'
- connection = get_connection('brevisurl.backends.local.BrevisUrlBackend', domain='http://test.com/d')
- brevisurl.settings.LOCAL_BACKEND_STRIP_TOKEN_URL_SLASH = False
+ connection = get_connection('brevisurl.backends.local.BrevisUrlBackend', domain='http://test.com/d/')
short_url = connection.shorten_url(original_url)
- self.assertRegexpMatches(short_url.shortened_url, r'^http://test\.com/d/[^/]{5}$')
- brevisurl.settings.LOCAL_BACKEND_STRIP_TOKEN_URL_SLASH = _original_slash_strip \ No newline at end of file
+ self.assertRegexpMatches(short_url.shortened_url, r'^http://test\.com/d/[^/]{5}$') \ No newline at end of file
diff --git a/brevisurl/tests/test_utils.py b/brevisurl/tests/test_utils.py
index a6a8fd2..c4b6237 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, url_has_protocol
+from brevisurl.utils import load_object, absurl, url_has_protocol, url_has_path
from brevisurl.backends.local import BrevisUrlBackend
@@ -62,4 +62,15 @@ class TestUrlHasProtocol(unittest.TestCase):
def test_url_without_protocol(self):
url = 'test.sk/path/'
- self.assertFalse(url_has_protocol(url)) \ No newline at end of file
+ self.assertFalse(url_has_protocol(url))
+
+
+class TestUrlHasPath(unittest.TestCase):
+
+ def test_url_with_path(self):
+ url = 'http://test.sk/'
+ self.assertTrue(url_has_path(url))
+
+ def test_url_without_path(self):
+ url = 'http://test.sk'
+ self.assertFalse(url_has_path(url)) \ No newline at end of file