tests.utils.extension_manager_tests Namespace Reference

Classes

class  ConfigManagerTests
 
class  ExtensionLibraries
 
class  ExtensionSettingsTestCase
 
class  GetConfigSettings
 
class  LoadConfigSettings
 

Functions

def test_init_extension_config
 

Detailed Description

This program is a part of The Commotion Client

Copyright (C) 2014  Seamus Tuohy s2e@opentechinstitute.org

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

Function Documentation

def tests.utils.extension_manager_tests.test_init_extension_config (   self)
Test that init extension config properly handles the various use cases.
533  """Test that init extension config properly handles the various use cases."""
534  #ext_type MUST be core|global|user
535  with self.assertRaises(ValueError):
536  self.ext_mgr.init_extension_config('pineapple')
537 
538  #Check for an empty directory.
539  self.ext_mgr.libraries['user'] = os.path.abspath("tests/temp/")
540  self.ext_mgr.init_extension_config('user')
541  self.assertFalse(self.ext_mgr.extensions['user'].has_configs())
542  self.ext_mgr.extensions['user'] = None
543 
544  #populate with populated directory
545  self.ext_mgr.libraries['user'] = os.path.abspath("tests/mock/extensions/")
546  self.ext_mgr.init_extension_config('user')
547  self.assertTrue(self.ext_mgr.extensions['user'].has_configs())
548  self.ext_mgr.extensions['user'] = None
549 
550  #check all types on default call
551  self.ext_mgr.libraries['user'] = os.path.abspath("tests/mock/extensions/")
552  self.ext_mgr.libraries['global'] = os.path.abspath("tests/mock/extensions/")
553  self.ext_mgr.libraries['core'] = os.path.abspath("tests/mock/extensions/")
554  self.ext_mgr.init_extension_config()
555  self.assertTrue(self.ext_mgr.extensions['user'].has_configs())
556  self.assertTrue(self.ext_mgr.extensions['global'].has_configs())
557  self.assertTrue(self.ext_mgr.extensions['core'].has_configs())
558  self.ext_mgr.extensions['user'] = None
559  self.ext_mgr.extensions['global'] = None
560  self.ext_mgr.extensions['core'] = None
def test_init_extension_config
Definition: extension_manager_tests.py:531