You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bloodhound.apache.org by rj...@apache.org on 2013/07/15 22:24:36 UTC

svn commit: r1503454 - /bloodhound/trunk/bloodhound_multiproduct/tests/hooks.py

Author: rjollos
Date: Mon Jul 15 20:24:35 2013
New Revision: 1503454

URL: http://svn.apache.org/r1503454
Log:
Added a failing test case for `ProductizedHref` contract violation. Refs #579.

Added:
    bloodhound/trunk/bloodhound_multiproduct/tests/hooks.py

Added: bloodhound/trunk/bloodhound_multiproduct/tests/hooks.py
URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_multiproduct/tests/hooks.py?rev=1503454&view=auto
==============================================================================
--- bloodhound/trunk/bloodhound_multiproduct/tests/hooks.py (added)
+++ bloodhound/trunk/bloodhound_multiproduct/tests/hooks.py Mon Jul 15 20:24:35 2013
@@ -0,0 +1,47 @@
+# -*- coding: utf-8 -*-
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+
+
+try:
+    import unittest2 as unittest
+except ImportError:
+    import unittest
+
+from trac.web.href import Href
+
+from multiproduct.hooks import ProductizedHref
+
+
+class ProductizedHrefTestCase(unittest.TestCase):
+
+    def test_params_is_dictionary(self):
+        ghref = Href('/base')
+        phref = ProductizedHref(ghref, '/product')
+        self.assertIn(phref({'param': 'value', 'other': 'other value'}),
+                      ['/product?param=value&other=other+value',
+                       '/product?other=other+value&param=value'])
+
+
+def test_suite():
+    return unittest.TestSuite([
+        unittest.makeSuite(ProductizedHrefTestCase, 'test')
+    ])
+
+if __name__ == '__main__':
+    unittest.main(defaultTest='test_suite')