Author: rjollos Date: Sun Aug 10 15:45:27 2014 New Revision: 1617129 URL: http://svn.apache.org/r1617129 Log: 0.8dev: Added unit tests to bloodhound_theme (1 test so far).
Added: bloodhound/trunk/bloodhound_theme/bhtheme/tests/ bloodhound/trunk/bloodhound_theme/bhtheme/tests/__init__.py (with props) bloodhound/trunk/bloodhound_theme/bhtheme/tests/theme.py (with props) Modified: bloodhound/trunk/bloodhound_theme/setup.py Added: bloodhound/trunk/bloodhound_theme/bhtheme/tests/__init__.py URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_theme/bhtheme/tests/__init__.py?rev=1617129&view=auto ============================================================================== --- bloodhound/trunk/bloodhound_theme/bhtheme/tests/__init__.py (added) +++ bloodhound/trunk/bloodhound_theme/bhtheme/tests/__init__.py Sun Aug 10 15:45:27 2014 @@ -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') Propchange: bloodhound/trunk/bloodhound_theme/bhtheme/tests/__init__.py ------------------------------------------------------------------------------ svn:eol-style = native Added: bloodhound/trunk/bloodhound_theme/bhtheme/tests/theme.py URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_theme/bhtheme/tests/theme.py?rev=1617129&view=auto ============================================================================== --- bloodhound/trunk/bloodhound_theme/bhtheme/tests/theme.py (added) +++ bloodhound/trunk/bloodhound_theme/bhtheme/tests/theme.py Sun Aug 10 15:45:27 2014 @@ -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') Propchange: bloodhound/trunk/bloodhound_theme/bhtheme/tests/theme.py ------------------------------------------------------------------------------ svn:eol-style = native Modified: bloodhound/trunk/bloodhound_theme/setup.py URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_theme/setup.py?rev=1617129&r1=1617128&r2=1617129&view=diff ============================================================================== --- bloodhound/trunk/bloodhound_theme/setup.py (original) +++ bloodhound/trunk/bloodhound_theme/setup.py Sun Aug 10 15:45:27 2014 @@ -56,6 +56,7 @@ setup( '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': [