Files
freezer-api/tests/test_driver.py
Fabrizio Vanni 3a9b0005a0 Fix stale import in freezer_api/storage/driver.py
freezer_api/storage/driver.py has a stale import

the referenced file is simpledict.py which is not
needed anymore and has been removed

Change-Id: Iaa97f7a4efaa6bbc97ef8fa5566d5c5a55d2a11f
Closes-Bug: #1457158
2015-05-20 18:34:06 +01:00

45 lines
1.5 KiB
Python

"""Freezer swift.py related tests
Copyright 2014 Hewlett-Packard
Licensed 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.
This product includes cryptographic software written by Eric Young
(eay@cryptsoft.com). This product includes software written by Tim
Hudson (tjh@cryptsoft.com).
========================================================================
"""
import unittest
from mock import patch
from oslo.config import cfg
from freezer_api.common.exceptions import *
from freezer_api.storage import driver, elastic
class TestStorageDriver(unittest.TestCase):
@patch('freezer_api.storage.elastic.logging')
def test_get_db_raises_when_db_not_supported(self, mock_logging):
cfg.CONF.storage.db = 'nodb'
self.assertRaises(Exception, driver.get_db)
@patch('freezer_api.storage.elastic.logging')
def test_get_db_elastic(self, mock_logging):
cfg.CONF.storage.db = 'elasticsearch'
db = driver.get_db()
self.assertIsInstance(db, elastic.ElasticSearchEngine)