Example #1
0
 def test_import_error(self, os, imp):
     imp.find_module.side_effect = ImportError()
     with pytest.raises(ConfigurationError):
         get_config_module()
Example #2
0
 def test_missing_home(self, os, imp):
     os.path.exists.return_value = False
     imp.find_module.return_value = Mock(), Mock(), Mock()
     get_config_module()
     assert_called_once_with(os.mkdir, ANY)
Example #3
0
    def test_get_config_module(self, os, imp):
        os.path.exists.return_value = True
        imp.find_module.return_value = Mock(), Mock(), Mock()
        imp.load_module.return_value = sentinel.config

        assert get_config_module() is sentinel.config
Example #4
0
 def test_import_error(self, os, imp):
     imp.find_module.side_effect = ImportError()
     with pytest.raises(ConfigurationError):
         get_config_module()
Example #5
0
 def test_missing_home(self, os, imp):
     os.path.exists.return_value = False
     imp.find_module.return_value = Mock(), Mock(), Mock()
     get_config_module()
     assert_called_once_with(os.mkdir, ANY)
Example #6
0
    def test_get_config_module(self, os, imp):
        os.path.exists.return_value = True
        imp.find_module.return_value = Mock(), Mock(), Mock()
        imp.load_module.return_value = sentinel.config

        assert get_config_module() is sentinel.config