"Fossies" - the Fresh Open Source Software Archive

Member "zun-4.0.0/zun/tests/unit/image/test_driver.py" (16 Oct 2019, 1506 Bytes) of package /linux/misc/openstack/zun-4.0.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "test_driver.py": 0.2.1_vs_2.1.0.

    1 # Copyright 2016 Intel.
    2 #
    3 # Licensed under the Apache License, Version 2.0 (the "License"); you may
    4 # not use this file except in compliance with the License. You may obtain
    5 # a copy of the License at
    6 #
    7 #      http://www.apache.org/licenses/LICENSE-2.0
    8 #
    9 # Unless required by applicable law or agreed to in writing, software
   10 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
   11 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
   12 # License for the specific language governing permissions and limitations
   13 # under the License.
   14 
   15 import zun.conf
   16 from zun.image.docker import driver as docker_driver
   17 from zun.image import driver
   18 from zun.image.glance import driver as glance_driver
   19 from zun.tests import base
   20 
   21 CONF = zun.conf.CONF
   22 
   23 
   24 class TestDriver(base.BaseTestCase):
   25     def setUp(self):
   26         super(TestDriver, self).setUp()
   27 
   28     def test_load_image_driver_failure(self):
   29         CONF.set_override('default_image_driver', None)
   30         self.assertRaises(SystemExit, driver.load_image_driver)
   31         self.assertRaises(SystemExit, driver.load_image_driver,
   32                           'UnknownDriver')
   33 
   34     def test_load_image_driver(self):
   35         image_driver = driver.load_image_driver()
   36         self.assertIsInstance(image_driver, docker_driver.DockerDriver)
   37 
   38         CONF.set_override('images_directory', None, group='glance')
   39         image_driver = driver.load_image_driver('glance')
   40         self.assertIsInstance(image_driver, glance_driver.GlanceDriver)