How to use expect_skip method in Slash

Best Python code snippet using slash

test_cli.py

Source:test_cli.py Github

copy

Full Screen

1# Copyright 2014 IBM Corp.2#3# Licensed under the Apache License, Version 2.0 (the "License"); you may4# not use this file except in compliance with the License. You may obtain5# a copy of the License at6#7# http://www.apache.org/licenses/LICENSE-2.08#9# Unless required by applicable law or agreed to in writing, software10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the12# License for the specific language governing permissions and limitations13# under the License.14import mock15import testtools16from tempest import cli17from tempest import exceptions18from tempest.tests import base19class TestMinClientVersion(base.TestCase):20 """Tests for the min_client_version decorator.21 """22 def _test_min_version(self, required, installed, expect_skip):23 @cli.min_client_version(client='nova', version=required)24 def fake(self, expect_skip):25 if expect_skip:26 # If we got here, the decorator didn't raise a skipException as27 # expected so we need to fail.28 self.fail('Should not have gotten past the decorator.')29 with mock.patch.object(cli, 'execute',30 return_value=installed) as mock_cmd:31 if expect_skip:32 self.assertRaises(testtools.TestCase.skipException, fake,33 self, expect_skip)34 else:35 fake(self, expect_skip)36 mock_cmd.assert_called_once_with('nova', '', params='--version',37 merge_stderr=True)38 def test_min_client_version(self):39 # required, installed, expect_skip40 cases = (('2.17.0', '2.17.0', False),41 ('2.17.0', '2.18.0', False),42 ('2.18.0', '2.17.0', True))43 for case in cases:44 self._test_min_version(*case)45 @mock.patch.object(cli, 'execute', return_value=' ')46 def test_check_client_version_empty_output(self, mock_execute):47 # Tests that an exception is raised if the command output is empty.48 self.assertRaises(exceptions.TempestException,...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Slash automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful