Commits

Olemis Lang  committed 9af247e

BH Multiproduct #115 : Enhanced db insertions. Minor typos fixed ... (failures=8, errors=13)

Ran 27 tests in 0.407s

  • Participants
  • Parent commits 8702d4b
  • Branches t115_product_env

Comments (0)

Files changed (2)

File t115/t115_r1423431_product_envs_testing.diff

 # HG changeset patch
-# Parent 405ee3c3f238f6db6214078215265c406e6cffcb
+# Parent 3292eb0a088d03616efea3545ab8737cb72d0098
 BH Theme #115 : Test cases for product environments
 
-diff -r 405ee3c3f238 bloodhound_multiproduct/tests/config.py
+diff -r 3292eb0a088d bloodhound_multiproduct/tests/config.py
 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-+++ b/bloodhound_multiproduct/tests/config.py	Sun Jan 06 19:49:32 2013 -0500
-@@ -0,0 +1,88 @@
++++ b/bloodhound_multiproduct/tests/config.py	Sun Jan 06 22:52:04 2013 -0500
+@@ -0,0 +1,94 @@
 +
 +#  Licensed to the Apache Software Foundation (ASF) under one
 +#  or more contributor license agreements.  See the NOTICE file
 +"""Tests for Apache(TM) Bloodhound's product configuration objects"""
 +
 +from ConfigParser import ConfigParser
++import os.path
 +from StringIO import StringIO
 +import unittest
 +
 +        r"""Replace Trac environment with product environment
 +        """
 +        self.env = self._setup_test_env()
++
++        # Dummy config file, a sibling of trac.ini
++        self.filename = os.path.join(self.env.path, 'conf', 'product.ini')
++
 +        self._upgrade_mp(self.env)
 +        self._setup_test_log(self.env)
 +        self._load_product_from_data(self.env, self.default_product)
 +                option_key = dict(section=_to_utf8(section), product=product)
 +                for option, value in parser.items(section):
 +                    option_key.update(dict(option=_to_utf8(option)))
-+                    setting = ProductSetting(self.env, option_key)
++                    setting = ProductSetting(self.env)
++                    setting._data.update(option_key)
 +                    setting.value = _to_utf8(value)
 +                    setting.insert()
 +
 +if __name__ == '__main__':
 +    unittest.main(defaultTest='suite')
 +
-diff -r 405ee3c3f238 bloodhound_multiproduct/tests/env.py
+diff -r 3292eb0a088d bloodhound_multiproduct/tests/env.py
 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-+++ b/bloodhound_multiproduct/tests/env.py	Sun Jan 06 19:49:32 2013 -0500
++++ b/bloodhound_multiproduct/tests/env.py	Sun Jan 06 22:52:04 2013 -0500
 @@ -0,0 +1,139 @@
 +
 +#  Licensed to the Apache Software Foundation (ASF) under one

File t115/t115_r1427886_product_config.diff

 
 diff -r 56bf5ca5136d bloodhound_dashboard/bhdashboard/model.py
 --- a/bloodhound_dashboard/bhdashboard/model.py	Sun Jan 06 12:53:47 2013 -0500
-+++ b/bloodhound_dashboard/bhdashboard/model.py	Sun Jan 06 19:57:29 2013 -0500
++++ b/bloodhound_dashboard/bhdashboard/model.py	Sun Jan 06 22:52:47 2013 -0500
 @@ -117,8 +117,9 @@
                  self._update_from_row(row)
                  break
              data = dict([(fields[i], row[i]) for i in range(len(fields))])
 diff -r 56bf5ca5136d bloodhound_multiproduct/multiproduct/api.py
 --- a/bloodhound_multiproduct/multiproduct/api.py	Sun Jan 06 12:53:47 2013 -0500
-+++ b/bloodhound_multiproduct/multiproduct/api.py	Sun Jan 06 19:57:29 2013 -0500
++++ b/bloodhound_multiproduct/multiproduct/api.py	Sun Jan 06 22:52:47 2013 -0500
 @@ -31,9 +31,9 @@
  from trac.util.translation import _, N_
  from trac.web.chrome import ITemplateProvider
      def get_version(self):
 diff -r 56bf5ca5136d bloodhound_multiproduct/multiproduct/config.py
 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-+++ b/bloodhound_multiproduct/multiproduct/config.py	Sun Jan 06 19:57:29 2013 -0500
-@@ -0,0 +1,277 @@
++++ b/bloodhound_multiproduct/multiproduct/config.py	Sun Jan 06 22:52:47 2013 -0500
+@@ -0,0 +1,279 @@
 +
 +#  Licensed to the Apache Software Foundation (ASF) under one
 +#  or more contributor license agreements.  See the NOTICE file
 +        """Return the configuration section with the specified name.
 +        """
 +        if name not in self._sections:
-+            self._section[name] = Section(self, name)
++            self._sections[name] = Section(self, name)
 +        return self._sections[name]
 +
 +    def sections(self, compmgr=None, defaults=True):
 +    def getpath(self, key, default=''):
 +        """Return a configuration value as an absolute path.
 +
-+        Relative paths are resolved relative to the location of the
-+        target global environment.
++        Relative paths are resolved relative to `conf` subfolder 
++        of the target global environment. This approach is consistent
++        with TracIni path resolution.
 +
 +        Valid default input is a string. Returns a normalized path.
 +
 +        if not path:
 +            return default
 +        if not os.path.isabs(path):
-+            path = os.path.join(self.env.path, path)
++            path = os.path.join(self.env.path, 'conf', path)
 +        return os.path.normcase(os.path.realpath(path))
 +
 +    def remove(self, key):
 +                'section' : _to_utf8(self.name),
 +                'option' : _to_utf8(key),
 +            }
-+        setting = ProductSetting(self.env, keys=option_key)
++        setting = ProductSetting(self.env)
++        setting._data.update(option_key)
 +
 +        if setting._exists :
 +            if value is None:
 +
 diff -r 56bf5ca5136d bloodhound_multiproduct/multiproduct/model.py
 --- a/bloodhound_multiproduct/multiproduct/model.py	Sun Jan 06 12:53:47 2013 -0500
-+++ b/bloodhound_multiproduct/multiproduct/model.py	Sun Jan 06 19:57:29 2013 -0500
++++ b/bloodhound_multiproduct/multiproduct/model.py	Sun Jan 06 22:52:47 2013 -0500
 @@ -18,6 +18,7 @@
  
  """Models to support multi-product"""