0.8dev: Added unit tests to bloodhound_theme (1 test so far).
git-svn-id: https://svn.apache.org/repos/asf/bloodhound/trunk@1617129 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bloodhound_theme/bhtheme/tests/__init__.py b/bloodhound_theme/bhtheme/tests/__init__.py
new file mode 100644
index 0000000..3d529ee
--- /dev/null
+++ b/bloodhound_theme/bhtheme/tests/__init__.py
@@ -0,0 +1,35 @@
+# -*- 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 bhtheme.tests import theme
+
+
+def suite():
+ test_suite = unittest.TestSuite()
+ test_suite.addTest(theme.suite())
+ return test_suite
+
+
+if __name__ == '__main__':
+ unittest.main(defaultTest='suite')
diff --git a/bloodhound_theme/bhtheme/tests/theme.py b/bloodhound_theme/bhtheme/tests/theme.py
new file mode 100644
index 0000000..ebfca86
--- /dev/null
+++ b/bloodhound_theme/bhtheme/tests/theme.py
@@ -0,0 +1,52 @@
+# -*- 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.
+
+from trac.test import EnvironmentStub
+from trac.web.chrome import Chrome
+
+from bhdashboard.web_ui import DashboardModule
+from bhtheme.theme import BloodhoundTheme
+from bhtheme.tests import unittest
+
+
+class ThemeTestCase(unittest.TestCase):
+
+ def setUp(self):
+ self.env = EnvironmentStub(enable=('trac.*', 'bhtheme.*'),
+ default_data=True)
+ self.bhtheme = BloodhoundTheme(self.env)
+
+ def tearDown(self):
+ self.env.reset_db()
+
+ def test_templates_dirs(self):
+ chrome = Chrome(self.env)
+ self.assertFalse(self.env.is_component_enabled(DashboardModule))
+ for dir in self.bhtheme.get_templates_dirs():
+ self.assertIn(dir, chrome.get_all_templates_dirs())
+
+
+def suite():
+ suite = unittest.TestSuite()
+ suite.addTest(unittest.makeSuite(ThemeTestCase))
+ return suite
+
+
+if __name__ == '__main__':
+ unittest.main(defaultTest='suite')
diff --git a/bloodhound_theme/setup.py b/bloodhound_theme/setup.py
index 328eade..9c3079d 100644
--- a/bloodhound_theme/setup.py
+++ b/bloodhound_theme/setup.py
@@ -56,6 +56,7 @@
'Framework :: Trac',
],
install_requires = ['BloodhoundDashboardPlugin', 'TracThemeEngine'],
+ test_suite = 'bhtheme.tests.suite',
tests_require = ['unittest2'] if sys.version_info < (2, 7) else [],
entry_points = {
'trac.plugins': [