From 47dcd0b920c7d6fc770b53b06445edf687c723c6 Mon Sep 17 00:00:00 2001
From: Arnaud Fontaine <arnaud.fontaine@nexedi.com>
Date: Tue, 13 Mar 2012 14:57:12 +0900
Subject: [PATCH] Add further checks in testImportVersionedComponentOnly.

---
 .../ERP5Type/tests/testDynamicClassGeneration.py   | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/product/ERP5Type/tests/testDynamicClassGeneration.py b/product/ERP5Type/tests/testDynamicClassGeneration.py
index b8d0e1418a..bb000e0496 100644
--- a/product/ERP5Type/tests/testDynamicClassGeneration.py
+++ b/product/ERP5Type/tests/testDynamicClassGeneration.py
@@ -1619,14 +1619,19 @@ class _TestZodbComponent(SecurityTestCase):
       """from %s.erp5_version.TestImportedVersionedComponentOnly import foo
 
 def bar(*args, **kwargs):
-  return foo(*args, **kwargs)
+  return 'Bar' + foo(*args, **kwargs)
 """ % top_module_name)
 
     component_import.validate()
     transaction.commit()
     self.tic()
 
+    # Versioned package and its alias must be available
     self.assertModuleImportable('TestImportVersionedComponentOnly')
+    self.assertModuleImportable('erp5_version.TestImportVersionedComponentOnly')
+
+    # Versioned Component of imported Component must be importable and check
+    # later that the module has not been added to the top-level package
     self.assertModuleImportable('erp5_version.TestImportedVersionedComponentOnly')
 
     top_module = __import__(top_module_name, level=0,
@@ -1644,6 +1649,13 @@ def bar(*args, **kwargs):
     # only the versioned Component has been used
     self.failIfHasAttribute(top_module, 'TestImportedVersionedComponentOnly')
 
+    # As well as functions defined on unversioned Component
+    self.assertHasAttribute(top_module.TestImportVersionedComponentOnly, 'bar')
+
+    self.assertEquals(
+      top_module.TestImportVersionedComponentOnly.bar(),
+      'BarTestImportedVersionedComponentOnly')
+
   def testVersionPriority(self):
     """
     Check whether Version priorities properly works by adding and removing
-- 
2.30.9