How to use contains_string method in Lemoncheesecake

Best Python code snippet using lemoncheesecake

debug_info_request_test.py

Source:debug_info_request_test.py Github

copy

Full Screen

...78 'path': None79 } )80 assert_that(81 FormatDebugInfoResponse( response ),82 contains_string(83 'No extra configuration file found\n'84 )85 )86def FormatDebugInfoResponse_ExtraConfFoundButNotLoaded_test():87 response = deepcopy( GENERIC_RESPONSE )88 response[ 'extra_conf' ].update( {89 'is_loaded': False,90 'path': '/path/to/extra/conf'91 } )92 assert_that(93 FormatDebugInfoResponse( response ),94 contains_string(95 'Extra configuration file found but not loaded\n'96 'Extra configuration path: /path/to/extra/conf\n'97 )98 )99def FormatDebugInfoResponse_ExtraConfFoundAndLoaded_test():100 response = deepcopy( GENERIC_RESPONSE )101 response[ 'extra_conf' ].update( {102 'is_loaded': True,103 'path': '/path/to/extra/conf'104 } )105 assert_that(106 FormatDebugInfoResponse( response ),107 contains_string(108 'Extra configuration file found and loaded\n'109 'Extra configuration path: /path/to/extra/conf\n'110 )111 )112def FormatDebugInfoResponse_Completer_ServerRunningWithHost_test():113 response = deepcopy( GENERIC_RESPONSE )114 assert_that(115 FormatDebugInfoResponse( response ),116 contains_string(117 'Completer name completer debug information:\n'118 ' Server name running at: http://127.0.0.1:1234\n'119 ' Server name process ID: 12345\n'120 ' Server name executable: /path/to/executable\n'121 ' Server name logfiles:\n'122 ' /path/to/stdout/logfile\n'123 ' /path/to/stderr/logfile\n'124 ' Server name key: value\n'125 ' Key: value\n'126 )127 )128def FormatDebugInfoResponse_Completer_ServerRunningWithoutHost_test():129 response = deepcopy( GENERIC_RESPONSE )130 response[ 'completer' ][ 'servers' ][ 0 ].update( {131 'address': None,132 'port': None133 } )134 assert_that(135 FormatDebugInfoResponse( response ),136 contains_string(137 'Completer name completer debug information:\n'138 ' Server name running\n'139 ' Server name process ID: 12345\n'140 ' Server name executable: /path/to/executable\n'141 ' Server name logfiles:\n'142 ' /path/to/stdout/logfile\n'143 ' /path/to/stderr/logfile\n'144 ' Server name key: value\n'145 ' Key: value\n'146 )147 )148def FormatDebugInfoResponse_Completer_ServerNotRunningWithNoLogfiles_test():149 response = deepcopy( GENERIC_RESPONSE )150 response[ 'completer' ][ 'servers' ][ 0 ].update( {151 'is_running': False,152 'logfiles': []153 } )154 assert_that(155 FormatDebugInfoResponse( response ),156 contains_string(157 'Completer name completer debug information:\n'158 ' Server name not running\n'159 ' Server name executable: /path/to/executable\n'160 ' No logfiles available\n'161 ' Server name key: value\n'162 ' Key: value\n'163 )...

Full Screen

Full Screen

test_project_processor.py

Source:test_project_processor.py Github

copy

Full Screen

...6 def check_file_exists_and_contains(self, filepath, substring):7 assert_that(exists(filepath), 'File "{}" doesn\'t exists')8 with open(filepath, encoding='utf-8') as f:9 text = f.read()10 assert_that(text, contains_string(substring))11 def check_cmake(self, project_dir):12 cmake_file = join(project_dir, 'CMakeLists.txt')13 with open(cmake_file, encoding='utf-8') as f:14 cmake_file_content = f.read()15 assert_that(cmake_file_content, contains_string('project(DemoProject)'))16 assert_that(cmake_file_content, contains_string('set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/build)'))17 assert_that(cmake_file_content, contains_string('"Drivers/CMSIS/Include"'))18 assert_that(cmake_file_content, contains_string('"Inc"'))19 assert_that(cmake_file_content, contains_string('"Src/*.cpp"'))20 assert_that(cmake_file_content, contains_string('"startup_stm32f303xc.s"'))21 assert_that(cmake_file_content, contains_string('add_definitions(-DSTM32F303xC)'))22 assert_that(cmake_file_content, contains_string(23 'set(PROJECT_OPTIMIZATION_FLAGS "-g -O0" CACHE STRING "Optimization/debug flags")'24 ))25 assert_that(cmake_file_content, contains_string('-mfpu=fpv4-sp-d16'))26 assert_that(cmake_file_content, contains_string('-mfloat-abi=hard'))27 def test_process_project(self):28 project_dir = self.get_tmp_copy(join(self.FIXTURE_DIR, 'stm32f3_project'))29 process_project(project_dir, overwrite=True)30 self.check_file_exists_and_contains(join(project_dir, 'CMakeLists.txt'), 'project')31 self.check_file_exists_and_contains(join(project_dir, 'build.sh'), 'build_dir="build"')32 self.check_file_exists_and_contains(join(project_dir, 'openocd_stm.cfg'), 'source [find target/stm32f3x.cfg]')...

Full Screen

Full Screen

test_cmake_generator.py

Source:test_cmake_generator.py Github

copy

Full Screen

...18 generate_cmake_from_make(project_description, cmake_file)19 # check cmake content20 with open(cmake_file, encoding='utf-8') as f:21 cmake_file_content = f.read()22 assert_that(cmake_file_content, contains_string('project(DemoProject)'))23 assert_that(cmake_file_content, contains_string('set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/build)'))24 assert_that(cmake_file_content, contains_string('"Drivers/CMSIS/Include"'))25 assert_that(cmake_file_content, contains_string('"Inc"'))26 assert_that(cmake_file_content, contains_string('"Src/*.cpp"'))27 assert_that(cmake_file_content, contains_string('"startup_stm32f303xc.s"'))28 assert_that(cmake_file_content, contains_string('add_definitions(-DSTM32F303xC)'))29 assert_that(cmake_file_content, contains_string(30 'set(PROJECT_OPTIMIZATION_FLAGS "-g -O0" CACHE STRING "Optimization/debug flags")'31 ))32 assert_that(cmake_file_content, contains_string('-mfpu=fpv4-sp-d16'))...

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 Lemoncheesecake 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