Author: jure Date: Mon Feb 18 15:24:57 2013 New Revision: 1447322 URL: http://svn.apache.org/r1447322 Log: #355, test cases for wiki modules, patch t355_r1444754_trac_test_wiki_model.diff applied (from Olemis)
Added: incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/wiki/ incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/wiki/__init__.py incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/wiki/model.py Modified: incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/env.py incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/attachment.py incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/env.py Modified: incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/env.py URL: http://svn.apache.org/viewvc/incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/env.py?rev=1447322&r1=1447321&r2=1447322&view=diff ============================================================================== --- incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/env.py (original) +++ incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/env.py Mon Feb 18 15:24:57 2013 @@ -217,7 +217,10 @@ class ProductEnvironment(Component, Comp top-level directory of the global environment will be the root of product file system area. """ - return os.path.join(self.parent.path, 'products', self.product.prefix) + folder = os.path.join(self.parent.path, 'products', self.product.prefix) + if not os.path.exists(folder): + os.makedirs(folder) + return folder @property def setup_participants(self): Modified: incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/attachment.py URL: http://svn.apache.org/viewvc/incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/attachment.py?rev=1447322&r1=1447321&r2=1447322&view=diff ============================================================================== --- incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/attachment.py (original) +++ incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/attachment.py Mon Feb 18 15:24:57 2013 @@ -44,7 +44,6 @@ class ProductAttachmentTestCase(Attachme self._setup_test_log(global_env) self._load_product_from_data(global_env, self.default_product) self.env = ProductEnvironment(global_env, self.default_product) - os.makedirs(self.env.path) # Root folder for default product environment self.attachments_dir = os.path.join(self.global_env.path, Modified: incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/env.py URL: http://svn.apache.org/viewvc/incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/env.py?rev=1447322&r1=1447321&r2=1447322&view=diff ============================================================================== --- incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/env.py (original) +++ incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/env.py Mon Feb 18 15:24:57 2013 @@ -137,6 +137,8 @@ class MultiproductTestCase(unittest.Test env.path = tempfile.mkdtemp('bh-product-tempenv') else: env.path = path + if not os.path.exists(path): + os.mkdir(path) return env def _setup_test_log(self, env): Added: incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/wiki/__init__.py URL: http://svn.apache.org/viewvc/incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/wiki/__init__.py?rev=1447322&view=auto ============================================================================== --- incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/wiki/__init__.py (added) +++ incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/wiki/__init__.py Mon Feb 18 15:24:57 2013 @@ -0,0 +1,20 @@ + +# 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. + +"""Tests for Apache(TM) Bloodhound's wiki subsystem in product environments""" + Added: incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/wiki/model.py URL: http://svn.apache.org/viewvc/incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/wiki/model.py?rev=1447322&view=auto ============================================================================== --- incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/wiki/model.py (added) +++ incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/wiki/model.py Mon Feb 18 15:24:57 2013 @@ -0,0 +1,55 @@ + +# 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. + +"""Tests for Apache(TM) Bloodhound's ticket reports in product environments""" + +import os.path +import shutil +import tempfile +import unittest + +from trac.wiki.tests.model import WikiPageTestCase + +from multiproduct.env import ProductEnvironment +from tests.env import MultiproductTestCase + +class ProductWikiPageTestCase(WikiPageTestCase, MultiproductTestCase): + + def setUp(self): + self.global_env = self._setup_test_env(create_folder=True, + path=os.path.join(tempfile.gettempdir(), 'trac-tempenv') ) + self._upgrade_mp(self.global_env) + self._setup_test_log(self.global_env) + self._load_product_from_data(self.global_env, self.default_product) + self.env = ProductEnvironment(self.global_env, self.default_product) + + + def tearDown(self): + self.global_env.reset_db() + shutil.rmtree(self.global_env.path) + self.env = self.global_env = None + + +def test_suite(): + return unittest.TestSuite([ + unittest.makeSuite(ProductWikiPageTestCase,'test'), + ]) + +if __name__ == '__main__': + unittest.main(defaultTest='test_suite') +