summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Basnight <mbasnight@gmail.com>2012-02-28 10:49:31 -0800
committerMichael Basnight <mbasnight@gmail.com>2012-02-28 10:49:31 -0800
commit1c5da13b9fc227323f7023327c8c97e9f446353f (patch)
tree37eb536a8d7216ee8d92895c5c835374a5fef0ca /tests
parent20cfad928c8dbae46e309f1e6150affd9d2b48c5 (diff)
downloadroutes-1c5da13b9fc227323f7023327c8c97e9f446353f.tar.gz
Added functionality to allow escaped dots in urls
* Added to regex to allow excaped dots in urls * Added tests to make sure escaped dots work and dont clobber the existing format strings --HG-- branch : trunk
Diffstat (limited to 'tests')
-rw-r--r--tests/test_functional/test_resources.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/test_functional/test_resources.py b/tests/test_functional/test_resources.py
index 333716b..9fd7ab9 100644
--- a/tests/test_functional/test_resources.py
+++ b/tests/test_functional/test_resources.py
@@ -127,6 +127,28 @@ class TestResourceRecognition(unittest.TestCase):
test_path('/people/2.json', 'PUT')
eq_({'controller':'people', 'action':'update', 'id':'2', 'format':'json'}, con.mapper_dict )
+ # Test for dots in urls
+ test_path('/people/2\.13', 'PUT')
+ eq_({'controller':'people', 'action':'update', 'id':'2\.13'}, con.mapper_dict)
+ test_path('/people/2\.13.xml', 'PUT')
+ eq_({'controller':'people', 'action':'update', 'id':'2\.13', 'format':'xml'}, con.mapper_dict)
+ test_path('/people/user\.name', 'PUT')
+ eq_({'controller':'people', 'action':'update', 'id':'user\.name'}, con.mapper_dict)
+ test_path('/people/user\.\.\.name', 'PUT')
+ eq_({'controller':'people', 'action':'update', 'id':'user\.\.\.name'}, con.mapper_dict)
+ test_path('/people/user\.name\.has\.dots', 'PUT')
+ eq_({'controller':'people', 'action':'update', 'id':'user\.name\.has\.dots'}, con.mapper_dict)
+ test_path('/people/user\.name\.is\.something.xml', 'PUT')
+ eq_({'controller':'people', 'action':'update', 'id':'user\.name\.is\.something', 'format':'xml'}, con.mapper_dict)
+ test_path('/people/user\.name\.ends\.with\.dot\..xml', 'PUT')
+ eq_({'controller':'people', 'action':'update', 'id':'user\.name\.ends\.with\.dot\.', 'format':'xml'}, con.mapper_dict)
+ test_path('/people/user\.name\.ends\.with\.dot\.', 'PUT')
+ eq_({'controller':'people', 'action':'update', 'id':'user\.name\.ends\.with\.dot\.'}, con.mapper_dict)
+ test_path('/people/\.user\.name\.starts\.with\.dot', 'PUT')
+ eq_({'controller':'people', 'action':'update', 'id':'\.user\.name\.starts\.with\.dot'}, con.mapper_dict)
+ test_path('/people/user\.name.json', 'PUT')
+ eq_({'controller':'people', 'action':'update', 'id':'user\.name', 'format':'json'}, con.mapper_dict)
+
def test_resource_with_nomin(self):
m = Mapper()
m.minimization = False