Best Python code snippet using molecule_python
test_scenario_section.py
Source:test_scenario_section.py
1# Copyright (c) 2015-2018 Cisco Systems, Inc.2#3# Permission is hereby granted, free of charge, to any person obtaining a copy4# of this software and associated documentation files (the "Software"), to5# deal in the Software without restriction, including without limitation the6# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or7# sell copies of the Software, and to permit persons to whom the Software is8# furnished to do so, subject to the following conditions:9#10# The above copyright notice and this permission notice shall be included in11# all copies or substantial portions of the Software.12#13# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR14# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,15# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE16# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER17# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING18# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER19# DEALINGS IN THE SOFTWARE.20import pytest21from molecule.model import schema_v222@pytest.fixture23def _model_scenario_section_data():24 return {25 'scenario': {26 'name': 'foo',27 'check_sequence': [28 'foo',29 ],30 'converge_sequence': [31 'foo',32 ],33 'create_sequence': [34 'foo',35 ],36 'destroy_sequence': [37 'foo',38 ],39 'test_sequence': [40 'foo',41 ],42 }43 }44@pytest.mark.parametrize(45 '_config', ['_model_scenario_section_data'], indirect=True)46def test_scenario(_config):47 assert {} == schema_v2.validate(_config)48@pytest.fixture49def _model_scenario_errors_section_data():50 return {51 'scenario': {52 'name': int(),53 'check_sequence': [54 int(),55 ],56 'converge_sequence': [57 int(),58 ],59 'create_sequence': [60 int(),61 ],62 'destroy_sequence': [63 int(),64 ],65 'test_sequence': [66 int(),67 ],68 }69 }70@pytest.mark.parametrize(71 '_config', ['_model_scenario_errors_section_data'], indirect=True)72def test_scenario_has_errors(_config):73 x = {74 'scenario': [{75 'converge_sequence': [{76 0: ['must be of string type'],77 }],78 'name': ['must be of string type'],79 'check_sequence': [{80 0: ['must be of string type'],81 }],82 'create_sequence': [{83 0: ['must be of string type'],84 }],85 'destroy_sequence': [{86 0: ['must be of string type'],87 }],88 'test_sequence': [{89 0: ['must be of string type'],90 }]91 }]92 }...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!