"Fossies" - the Fresh Open Source Software Archive

Member "murano-8.0.0/murano/engine/system/test_fixture.py" (16 Oct 2019, 1676 Bytes) of package /linux/misc/openstack/murano-8.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.

    1 # Copyright (c) 2015 Mirantis Inc.
    2 #
    3 # Licensed under the Apache License, Version 2.0 (the "License");
    4 # you may not use this file except in compliance with the License.
    5 # You may obtain 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,
   11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
   12 # implied.
   13 # See the License for the specific language governing permissions and
   14 # limitations under the License.
   15 
   16 import testtools
   17 
   18 from murano.dsl import dsl
   19 from murano.dsl import helpers
   20 
   21 
   22 @dsl.name('io.murano.test.TestFixture')
   23 class TestFixture(object):
   24     def __init__(self):
   25         self._test_case = testtools.TestCase('__init__')
   26 
   27     def load(self, model):
   28         exc = helpers.get_executor()
   29         return exc.load(model)
   30 
   31     def finish_env(self):
   32         session = helpers.get_execution_session()
   33         session.finish()
   34 
   35     def start_env(self):
   36         session = helpers.get_execution_session()
   37         session.start()
   38 
   39     def assert_equal(self, expected, observed, message=None):
   40         self._test_case.assertEqual(expected, observed, message)
   41 
   42     def assert_true(self, expr, message=None):
   43         self._test_case.assertTrue(expr, message)
   44 
   45     def assert_false(self, expr, message=None):
   46         self._test_case.assertFalse(expr, message)
   47 
   48     def assert_in(self, needle, haystack, message=None):
   49         self._test_case.assertIn(needle, haystack, message)
   50 
   51     def assert_not_in(self, needle, haystack, message=None):
   52         self._test_case.assertNotIn(needle, haystack, message)