Commits

Olemis Lang committed 3e26a53

BH Multiproduct #387 : Parameterize Bloodhound installer script at test time by overriding _bloodhound_installer_args

  • Participants
  • Parent commits c2cd3b7
  • Branches t387_test_functional

Comments (0)

Files changed (1)

t387/t387_r1515319_functional_test.6.diff

 
 diff -r dc26c55b4721 bloodhound_multiproduct/tests/functional/__init__.py
 --- a/bloodhound_multiproduct/tests/functional/__init__.py	Thu Aug 29 12:43:46 2013 -0500
-+++ b/bloodhound_multiproduct/tests/functional/__init__.py	Thu Aug 29 14:09:25 2013 -0500
++++ b/bloodhound_multiproduct/tests/functional/__init__.py	Sat Aug 31 17:30:29 2013 -0500
 @@ -35,9 +35,10 @@
  from trac.util.compat import close_fds
  from trac.util.text import unicode_quote
  from tests import unittest
  
  #----------------
-@@ -290,6 +291,10 @@
-                           repo_path=self.repo_path_for_initenv(),
-                           sourcedir=self.bh_src)
+@@ -57,6 +58,7 @@
+     def init(self):
+         """Determine the location of Trac source code
+         """
++        self.bh_install_project = 'trac'
+         self.bhmp_upgrade = False
+         self.trac_src = os.path.realpath(os.path.join( 
+                 __import__('trac', []).__file__, '..' , '..'))
+@@ -252,6 +254,17 @@
  
+     # Protected methods
+ 
++    @property
++    def _bloodhound_install_args(self):
++        """Determine arguments supplied in to Bloodhound installer.
++        """
++        return dict(adminuser='admin', adminpass='admin', 
++                    dbstring=self.dburi, default_product_prefix='test',
++                    digestfile=self.htdigest, realm=self.htdigest_realm,
++                    repo_type=self.repotype,
++                    repo_path=self.repo_path_for_initenv(),
++                    sourcedir=self.bh_src)
++
+     def _bloodhound_install(self):
+         """Execute Bloodhound installer script
+         """
+@@ -267,29 +280,22 @@
+                                       os.path.join(self.bh_src, 'installer',
+                                                    'bloodhound_setup.py'))
+ 
+-            #FIXME: Account manager's store will not work even after this
+-            # Prepare installer for HTTP basic authentication store
+-#            bhsetup.ACCOUNTS_CONFIG['account-manager'].update(
+-#                          {'htpasswd_file' : self.htpasswd,
+-#                           'password_store' : 'HtPasswdStore'})
+-
+             # Enable timeline and roadmap views; needed in functional tests
+             bhsetup.BASE_CONFIG['mainnav'].update({'timeline': 'enabled',
+                                                    'roadmap': 'enabled'})
+ 
+-            bhsetup = bhsetup.BloodhoundSetup({'project' : 'trac',
++            bhsetup = bhsetup.BloodhoundSetup({'project' : self.bh_install_project,
+                                                'envsdir' : self.dirname})
+ 
+             # Do not perform Bloodhound-specific wiki upgrades
+             bhsetup.apply_bhwiki_upgrades = False
+ 
+-            bhsetup.setup(adminuser='admin', adminpass='admin', 
+-                          dbstring=self.dburi, default_product_prefix='test',
+-                          digestfile=self.htdigest, realm=self.htdigest_realm,
+-                          repo_type=self.repotype,
+-                          repo_path=self.repo_path_for_initenv(),
+-                          sourcedir=self.bh_src)
+-
++            bh_install_args = self._bloodhound_install_args
++            bhsetup.setup(**bh_install_args)
 +        except:
 +            raise
 +        else:
          finally:
              os.chdir(cwd)
  
-@@ -652,9 +657,10 @@
+@@ -652,9 +658,10 @@
      As a consequence some methods of Trac functional tester have to be
      executed in special ways.
      """
  
      class in_product(BloodhoundFunctionalTester.in_product):
          """Context manager temporarily switching to product URL
-@@ -744,10 +750,26 @@
+@@ -744,10 +751,26 @@
  
      tester_class = BloodhoundGlobalEnvFunctionalTester