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/13 12:23:16 UTC

svn commit: r1502769 - /bloodhound/trunk/bloodhound_multiproduct/tests/web_ui.py

Author: rjollos
Date: Sat Jul 13 10:23:16 2013
New Revision: 1502769

URL: http://svn.apache.org/r1502769
Log:
Modify test case now that //Product List// page is displayed when navigating to a non-existing product after [1495037]. Refs #561.

Modified:
    bloodhound/trunk/bloodhound_multiproduct/tests/web_ui.py

Modified: bloodhound/trunk/bloodhound_multiproduct/tests/web_ui.py
URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_multiproduct/tests/web_ui.py?rev=1502769&r1=1502768&r2=1502769&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_multiproduct/tests/web_ui.py (original)
+++ bloodhound/trunk/bloodhound_multiproduct/tests/web_ui.py Sat Jul 13 10:23:16 2013
@@ -216,13 +216,6 @@ class ProductModuleTestCase(RequestHandl
         spy = self.global_env[TestRequestSpy]
         self.assertIsNot(None, spy)
 
-        # Missing product
-        req = self._get_request_obj(self.global_env)
-        req.authname = 'testuser'
-        req.environ['PATH_INFO'] = '/products/missing'
-
-        real_prefix = None
-
         def assert_product_view(req, template, data, content_type):
             self.assertEquals('product_view.html', template)
             self.assertIs(None, content_type)
@@ -238,11 +231,6 @@ class ProductModuleTestCase(RequestHandl
 
         spy.testProcessing = assert_product_view
 
-        self.expectedPrefix = 'missing'
-        self.expectedPathInfo = ''
-        with self.assertRaises(RequestDone):
-            self._dispatch(req, self.global_env)
-
         # Existing product
         req = self._get_request_obj(self.global_env)
         req.authname = 'testuser'
@@ -254,6 +242,33 @@ class ProductModuleTestCase(RequestHandl
         with self.assertRaises(RequestDone):
             self._dispatch(req, self.global_env)
 
+    def test_missing_product(self):
+        spy = self.global_env[TestRequestSpy]
+        self.assertIsNot(None, spy)
+
+        mps = MultiProductSystem(self.global_env)
+        def assert_product_list(req, template, data, content_type):
+            self.assertEquals('product_list.html', template)
+            self.assertIs(None, content_type)
+            self.assertEquals([mps.default_product_prefix,
+                               self.default_product],
+                              [p.prefix for p in data.get('products')])
+            self.assertTrue('context' in data)
+            ctx = data['context']
+            self.assertEquals('product', ctx.resource.realm)
+            self.assertEquals(None, ctx.resource.id)
+
+        spy.testProcessing = assert_product_list
+
+        # Missing product
+        req = self._get_request_obj(self.global_env)
+        req.authname = 'testuser'
+        req.environ['PATH_INFO'] = '/products/missing'
+
+        self.expectedPrefix = 'missing'
+        self.expectedPathInfo = ''
+        with self.assertRaises(RequestDone):
+            self._dispatch(req, self.global_env)
 
     def test_product_edit(self):
         spy = self.global_env[TestRequestSpy]