How to use has_items method in Lemoncheesecake

Best Python code snippet using lemoncheesecake

get_completions_test.py

Source:get_completions_test.py Github

copy

Full Screen

...58 response_data = app.post_json( '/completions', completion_data ).json59 eq_( 1, response_data[ 'completion_start_column' ] )60 assert_that(61 response_data[ 'completions' ],62 has_items( CompletionEntryMatcher( 'foo', '[ID]' ),63 CompletionEntryMatcher( 'foogoo', '[ID]' ) )64 )65@IsolatedYcmd( { 'min_num_identifier_candidate_chars': 4 } )66def GetCompletions_IdentifierCompleter_FilterShortCandidates_test( app ):67 event_data = BuildRequest( contents = 'foo foogoo gooo',68 event_name = 'FileReadyToParse' )69 app.post_json( '/event_notification', event_data )70 completion_data = BuildRequest( contents = 'oo', column_num = 3 )71 response = app.post_json( '/completions',72 completion_data ).json[ 'completions' ]73 assert_that( response,74 contains_inanyorder( CompletionEntryMatcher( 'foogoo' ),75 CompletionEntryMatcher( 'gooo' ) ) )76@SharedYcmd77def GetCompletions_IdentifierCompleter_StartColumn_AfterWord_test( app ):78 completion_data = BuildRequest( contents = 'oo foo foogoo ba',79 column_num = 11 )80 response_data = app.post_json( '/completions', completion_data ).json81 eq_( 8, response_data[ 'completion_start_column' ] )82@SharedYcmd83def GetCompletions_IdentifierCompleter_WorksForSpecialIdentifierChars_test(84 app ):85 contents = """86 textarea {87 font-family: sans-serif;88 font-size: 12px;89 }"""90 event_data = BuildRequest( contents = contents,91 filetype = 'css',92 event_name = 'FileReadyToParse' )93 app.post_json( '/event_notification', event_data )94 # query is 'fo'95 completion_data = BuildRequest( contents = 'fo ' + contents,96 filetype = 'css',97 column_num = 3 )98 results = app.post_json( '/completions',99 completion_data ).json[ 'completions' ]100 assert_that(101 results,102 has_items( CompletionEntryMatcher( 'font-size', '[ID]' ),103 CompletionEntryMatcher( 'font-family', '[ID]' ) )104 )105@SharedYcmd106def GetCompletions_IdentifierCompleter_Unicode_InLine_test( app ):107 contents = """108 This is some text cøntaining unicøde109 """110 event_data = BuildRequest( contents = contents,111 filetype = 'css',112 event_name = 'FileReadyToParse' )113 app.post_json( '/event_notification', event_data )114 # query is 'tx'115 completion_data = BuildRequest( contents = 'tx ' + contents,116 filetype = 'css',117 column_num = 3 )118 results = app.post_json( '/completions',119 completion_data ).json[ 'completions' ]120 assert_that(121 results,122 has_items( CompletionEntryMatcher( 'text', '[ID]' ) )123 )124@SharedYcmd125def GetCompletions_IdentifierCompleter_UnicodeQuery_InLine_test( app ):126 contents = """127 This is some text cøntaining unicøde128 """129 event_data = BuildRequest( contents = contents,130 filetype = 'css',131 event_name = 'FileReadyToParse' )132 app.post_json( '/event_notification', event_data )133 # query is 'cø'134 completion_data = BuildRequest( contents = 'cø ' + contents,135 filetype = 'css',136 column_num = 4 )137 results = app.post_json( '/completions',138 completion_data ).json[ 'completions' ]139 assert_that(140 results,141 has_items( CompletionEntryMatcher( 'cøntaining', '[ID]' ),142 CompletionEntryMatcher( 'unicøde', '[ID]' ) )143 )144@IsolatedYcmd()145def GetCompletions_IdentifierCompleter_Unicode_MultipleCodePoints_test( app ):146 # The first ō is on one code point while the second is on two ("o" + combining147 # macron character).148 event_data = BuildRequest( contents = 'fōo\nfōo',149 event_name = 'FileReadyToParse' )150 app.post_json( '/event_notification', event_data )151 # query is 'fo'152 completion_data = BuildRequest( contents = 'fōo\nfōo\nfo',153 line_num = 3,154 column_num = 3 )155 response_data = app.post_json( '/completions', completion_data ).json156 eq_( 1, response_data[ 'completion_start_column' ] )157 assert_that(158 response_data[ 'completions' ],159 has_items( CompletionEntryMatcher( 'fōo', '[ID]' ),160 CompletionEntryMatcher( 'fōo', '[ID]' ) )161 )162@SharedYcmd163@patch( 'ycmd.tests.test_utils.DummyCompleter.CandidatesList',164 return_value = [ 'foo', 'bar', 'qux' ] )165def GetCompletions_ForceSemantic_Works_test( app, *args ):166 with PatchCompleter( DummyCompleter, 'dummy_filetype' ):167 completion_data = BuildRequest( filetype = 'dummy_filetype',168 force_semantic = True )169 results = app.post_json( '/completions',170 completion_data ).json[ 'completions' ]171 assert_that( results, has_items( CompletionEntryMatcher( 'foo' ),172 CompletionEntryMatcher( 'bar' ),173 CompletionEntryMatcher( 'qux' ) ) )174@SharedYcmd175def GetCompletions_ForceSemantic_NoSemanticCompleter_test( app, *args ):176 event_data = BuildRequest( event_name = 'FileReadyToParse',177 filetype = 'dummy_filetype',178 contents = 'complete_this_word\ncom' )179 app.post_json( '/event_notification', event_data )180 completion_data = BuildRequest( filetype = 'dummy_filetype',181 force_semantic = True,182 contents = 'complete_this_word\ncom',183 line_number = 2,184 column_num = 4 )185 results = app.post_json( '/completions', completion_data ).json186 assert_that( results, has_entries( {187 'completions': empty(),188 'errors': empty(),189 } ) )190 # For proof, show that non-forced completion would return identifiers191 completion_data = BuildRequest( filetype = 'dummy_filetype',192 contents = 'complete_this_word\ncom',193 line_number = 2,194 column_num = 4 )195 results = app.post_json( '/completions', completion_data ).json196 assert_that( results, has_entries( {197 'completions': contains(198 CompletionEntryMatcher( 'com' ),199 CompletionEntryMatcher( 'complete_this_word' ) ),200 'errors': empty(),201 } ) )202@SharedYcmd203def GetCompletions_IdentifierCompleter_SyntaxKeywordsAdded_test( app ):204 event_data = BuildRequest( event_name = 'FileReadyToParse',205 syntax_keywords = ['foo', 'bar', 'zoo'] )206 app.post_json( '/event_notification', event_data )207 completion_data = BuildRequest( contents = 'oo ',208 column_num = 3 )209 results = app.post_json( '/completions',210 completion_data ).json[ 'completions' ]211 assert_that( results,212 has_items( CompletionEntryMatcher( 'foo' ),213 CompletionEntryMatcher( 'zoo' ) ) )214@SharedYcmd215def GetCompletions_IdentifierCompleter_TagsAdded_test( app ):216 event_data = BuildRequest( event_name = 'FileReadyToParse',217 tag_files = [ PathToTestFile( 'basic.tags' ) ] )218 app.post_json( '/event_notification', event_data )219 completion_data = BuildRequest( contents = 'oo',220 column_num = 3,221 filetype = 'cpp' )222 results = app.post_json( '/completions',223 completion_data ).json[ 'completions' ]224 assert_that( results,225 has_items( CompletionEntryMatcher( 'foosy' ),226 CompletionEntryMatcher( 'fooaaa' ) ) )227@SharedYcmd228def GetCompletions_IdentifierCompleter_JustFinishedIdentifier_test( app ):229 event_data = BuildRequest( event_name = 'CurrentIdentifierFinished',230 column_num = 4,231 contents = 'foo' )232 app.post_json( '/event_notification', event_data )233 completion_data = BuildRequest( contents = 'oo', column_num = 3 )234 results = app.post_json( '/completions',235 completion_data ).json[ 'completions' ]236 assert_that( results,237 has_items( CompletionEntryMatcher( 'foo' ) ) )238@IsolatedYcmd()239def GetCompletions_IdentifierCompleter_IgnoreFinishedIdentifierInString_test(240 app ):241 event_data = BuildRequest( event_name = 'CurrentIdentifierFinished',242 column_num = 6,243 contents = '"foo"' )244 app.post_json( '/event_notification', event_data )245 completion_data = BuildRequest( contents = 'oo', column_num = 3 )246 results = app.post_json( '/completions',247 completion_data ).json[ 'completions' ]248 assert_that( results, empty() )249@SharedYcmd250def GetCompletions_IdentifierCompleter_IdentifierUnderCursor_test( app ):251 event_data = BuildRequest( event_name = 'InsertLeave',252 column_num = 2,253 contents = 'foo' )254 app.post_json( '/event_notification', event_data )255 completion_data = BuildRequest( contents = 'oo', column_num = 3 )256 results = app.post_json( '/completions',257 completion_data ).json[ 'completions' ]258 assert_that( results,259 has_items( CompletionEntryMatcher( 'foo' ) ) )260@IsolatedYcmd()261def GetCompletions_IdentifierCompleter_IgnoreCursorIdentifierInString_test(262 app ):263 event_data = BuildRequest( event_name = 'InsertLeave',264 column_num = 3,265 contents = '"foo"' )266 app.post_json( '/event_notification', event_data )267 completion_data = BuildRequest( contents = 'oo', column_num = 3 )268 results = app.post_json( '/completions',269 completion_data ).json[ 'completions' ]270 assert_that( results, empty() )271@SharedYcmd272def GetCompletions_FilenameCompleter_Works_test( app ):273 filepath = PathToTestFile( 'filename_completer', 'test.foo' )274 completion_data = BuildRequest( filepath = filepath,275 contents = './',276 column_num = 3 )277 results = app.post_json( '/completions',278 completion_data ).json[ 'completions' ]279 assert_that( results,280 has_items( CompletionEntryMatcher( 'inner_dir', '[Dir]' ) ) )281@SharedYcmd282def GetCompletions_UltiSnipsCompleter_Works_test( app ):283 event_data = BuildRequest(284 event_name = 'BufferVisit',285 ultisnips_snippets = [286 {'trigger': 'foo', 'description': 'bar'},287 {'trigger': 'zoo', 'description': 'goo'},288 ] )289 app.post_json( '/event_notification', event_data )290 completion_data = BuildRequest( contents = 'oo ',291 column_num = 3 )292 results = app.post_json( '/completions',293 completion_data ).json[ 'completions' ]294 assert_that(295 results,296 has_items(297 CompletionEntryMatcher( 'foo', extra_menu_info='<snip> bar' ),298 CompletionEntryMatcher( 'zoo', extra_menu_info='<snip> goo' )299 )300 )301@IsolatedYcmd( { 'use_ultisnips_completer': 0 } )302def GetCompletions_UltiSnipsCompleter_UnusedWhenOffWithOption_test( app ):303 event_data = BuildRequest(304 event_name = 'BufferVisit',305 ultisnips_snippets = [306 {'trigger': 'foo', 'description': 'bar'},307 {'trigger': 'zoo', 'description': 'goo'},308 ] )309 app.post_json( '/event_notification', event_data )310 completion_data = BuildRequest( contents = 'oo ', column_num = 3 )311 eq_( [],312 app.post_json( '/completions',313 completion_data ).json[ 'completions' ] )314@IsolatedYcmd( { 'semantic_triggers': { 'dummy_filetype': [ '_' ] } } )315@patch( 'ycmd.tests.test_utils.DummyCompleter.CandidatesList',316 return_value = [ 'some_candidate' ] )317def GetCompletions_SemanticCompleter_WorksWhenTriggerIsIdentifier_test(318 app, *args ):319 with PatchCompleter( DummyCompleter, 'dummy_filetype' ):320 completion_data = BuildRequest( filetype = 'dummy_filetype',321 contents = 'some_can',322 column_num = 9 )323 results = app.post_json( '/completions',324 completion_data ).json[ 'completions' ]325 assert_that(326 results,327 has_items( CompletionEntryMatcher( 'some_candidate' ) )328 )329@SharedYcmd330@patch( 'ycmd.tests.test_utils.DummyCompleter.ShouldUseNowInner',331 return_value = True )332@patch( 'ycmd.tests.test_utils.DummyCompleter.CandidatesList',333 return_value = [ 'attribute' ] )334def GetCompletions_CacheIsValid_test(335 app, candidates_list, *args ):336 with PatchCompleter( DummyCompleter, 'dummy_filetype' ):337 completion_data = BuildRequest( filetype = 'dummy_filetype',338 contents = 'object.attr',339 line_num = 1,340 column_num = 12 )341 results = app.post_json( '/completions',342 completion_data ).json[ 'completions' ]343 assert_that(344 results,345 has_items( CompletionEntryMatcher( 'attribute' ) )346 )347 completion_data = BuildRequest( filetype = 'dummy_filetype',348 contents = 'object.attri',349 line_num = 1,350 column_num = 13 )351 results = app.post_json( '/completions',352 completion_data ).json[ 'completions' ]353 assert_that(354 results,355 has_items( CompletionEntryMatcher( 'attribute' ) )356 )357 # We ask for candidates only once because of cache.358 assert_that( candidates_list.call_count, equal_to( 1 ) )359@SharedYcmd360@patch( 'ycmd.tests.test_utils.DummyCompleter.ShouldUseNowInner',361 return_value = True )362@patch( 'ycmd.tests.test_utils.DummyCompleter.CandidatesList',363 side_effect = [ [ 'attributeA' ], [ 'attributeB' ] ] )364def GetCompletions_CacheIsNotValid_DifferentLineNumber_test(365 app, candidates_list, *args ):366 with PatchCompleter( DummyCompleter, 'dummy_filetype' ):367 completion_data = BuildRequest( filetype = 'dummy_filetype',368 contents = 'objectA.attr\n'369 'objectB.attr',370 line_num = 1,371 column_num = 12 )372 results = app.post_json( '/completions',373 completion_data ).json[ 'completions' ]374 assert_that(375 results,376 has_items( CompletionEntryMatcher( 'attributeA' ) )377 )378 completion_data = BuildRequest( filetype = 'dummy_filetype',379 contents = 'objectA.\n'380 'objectB.',381 line_num = 2,382 column_num = 12 )383 results = app.post_json( '/completions',384 completion_data ).json[ 'completions' ]385 assert_that(386 results,387 has_items( CompletionEntryMatcher( 'attributeB' ) )388 )389 # We ask for candidates twice because of cache invalidation:390 # line numbers are different between requests.391 assert_that( candidates_list.call_count, equal_to( 2 ) )392@SharedYcmd393@patch( 'ycmd.tests.test_utils.DummyCompleter.ShouldUseNowInner',394 return_value = True )395@patch( 'ycmd.tests.test_utils.DummyCompleter.CandidatesList',396 side_effect = [ [ 'attributeA' ], [ 'attributeB' ] ] )397def GetCompletions_CacheIsNotValid_DifferentStartColumn_test(398 app, candidates_list, *args ):399 with PatchCompleter( DummyCompleter, 'dummy_filetype' ):400 # Start column is 9401 completion_data = BuildRequest( filetype = 'dummy_filetype',402 contents = 'objectA.attr',403 line_num = 1,404 column_num = 12 )405 results = app.post_json( '/completions',406 completion_data ).json[ 'completions' ]407 assert_that(408 results,409 has_items( CompletionEntryMatcher( 'attributeA' ) )410 )411 # Start column is 8412 completion_data = BuildRequest( filetype = 'dummy_filetype',413 contents = 'object.attri',414 line_num = 1,415 column_num = 12 )416 results = app.post_json( '/completions',417 completion_data ).json[ 'completions' ]418 assert_that(419 results,420 has_items( CompletionEntryMatcher( 'attributeB' ) )421 )422 # We ask for candidates twice because of cache invalidation:423 # start columns are different between requests.424 assert_that( candidates_list.call_count, equal_to( 2 ) )425@SharedYcmd426@patch( 'ycmd.tests.test_utils.DummyCompleter.ShouldUseNowInner',427 return_value = True )428@patch( 'ycmd.tests.test_utils.DummyCompleter.CandidatesList',429 side_effect = [ [ 'attributeA' ], [ 'attributeB' ] ] )430def GetCompletions_CacheIsNotValid_DifferentForceSemantic_test(431 app, candidates_list, *args ):432 with PatchCompleter( DummyCompleter, 'dummy_filetype' ):433 completion_data = BuildRequest( filetype = 'dummy_filetype',434 contents = 'objectA.attr',435 line_num = 1,436 column_num = 12,437 force_semantic = True )438 results = app.post_json( '/completions',439 completion_data ).json[ 'completions' ]440 assert_that(441 results,442 has_items( CompletionEntryMatcher( 'attributeA' ) )443 )444 completion_data = BuildRequest( filetype = 'dummy_filetype',445 contents = 'objectA.attr',446 line_num = 1,447 column_num = 12 )448 results = app.post_json( '/completions',449 completion_data ).json[ 'completions' ]450 assert_that(451 results,452 has_items( CompletionEntryMatcher( 'attributeB' ) )453 )454 # We ask for candidates twice because of cache invalidation:455 # semantic completion is forced for one of the request, not the other.456 assert_that( candidates_list.call_count, equal_to( 2 ) )457@SharedYcmd458@patch( 'ycmd.tests.test_utils.DummyCompleter.ShouldUseNowInner',459 return_value = True )460@patch( 'ycmd.tests.test_utils.DummyCompleter.CandidatesList',461 side_effect = [ [ 'attributeA' ], [ 'attributeB' ] ] )462def GetCompletions_CacheIsNotValid_DifferentContents_test(463 app, candidates_list, *args ):464 with PatchCompleter( DummyCompleter, 'dummy_filetype' ):465 completion_data = BuildRequest( filetype = 'dummy_filetype',466 contents = 'objectA = foo\n'467 'objectA.attr',468 line_num = 2,469 column_num = 12 )470 results = app.post_json( '/completions',471 completion_data ).json[ 'completions' ]472 assert_that(473 results,474 has_items( CompletionEntryMatcher( 'attributeA' ) )475 )476 completion_data = BuildRequest( filetype = 'dummy_filetype',477 contents = 'objectA = bar\n'478 'objectA.attr',479 line_num = 2,480 column_num = 12 )481 results = app.post_json( '/completions',482 completion_data ).json[ 'completions' ]483 assert_that(484 results,485 has_items( CompletionEntryMatcher( 'attributeB' ) )486 )487 # We ask for candidates twice because of cache invalidation:488 # both requests have the same cursor position and current line but file489 # contents are different.490 assert_that( candidates_list.call_count, equal_to( 2 ) )491@SharedYcmd492@patch( 'ycmd.tests.test_utils.DummyCompleter.ShouldUseNowInner',493 return_value = True )494@patch( 'ycmd.tests.test_utils.DummyCompleter.CandidatesList',495 side_effect = [ [ 'attributeA' ], [ 'attributeB' ] ] )496def GetCompletions_CacheIsNotValid_DifferentNumberOfLines_test(497 app, candidates_list, *args ):498 with PatchCompleter( DummyCompleter, 'dummy_filetype' ):499 completion_data = BuildRequest( filetype = 'dummy_filetype',500 contents = 'objectA.attr\n'501 'objectB.attr',502 line_num = 1,503 column_num = 12 )504 results = app.post_json( '/completions',505 completion_data ).json[ 'completions' ]506 assert_that(507 results,508 has_items( CompletionEntryMatcher( 'attributeA' ) )509 )510 completion_data = BuildRequest( filetype = 'dummy_filetype',511 contents = 'objectA.attr',512 line_num = 1,513 column_num = 12 )514 results = app.post_json( '/completions',515 completion_data ).json[ 'completions' ]516 assert_that(517 results,518 has_items( CompletionEntryMatcher( 'attributeB' ) )519 )520 # We ask for candidates twice because of cache invalidation:521 # both requests have the same cursor position and current line but the522 # number of lines in the current file is different.523 assert_that( candidates_list.call_count, equal_to( 2 ) )524@SharedYcmd525@patch( 'ycmd.tests.test_utils.DummyCompleter.ShouldUseNowInner',526 return_value = True )527@patch( 'ycmd.tests.test_utils.DummyCompleter.CandidatesList',528 side_effect = [ [ 'attributeA' ], [ 'attributeB' ] ] )529def GetCompletions_CacheIsNotValid_DifferentFileData_test(530 app, candidates_list, *args ):531 with PatchCompleter( DummyCompleter, 'dummy_filetype' ):532 completion_data = BuildRequest( filetype = 'dummy_filetype',533 contents = 'objectA.attr',534 line_num = 1,535 column_num = 12,536 file_data = {537 '/bar': {538 'contents': 'objectA = foo',539 'filetypes': [ 'dummy_filetype' ]540 }541 } )542 results = app.post_json( '/completions',543 completion_data ).json[ 'completions' ]544 assert_that(545 results,546 has_items( CompletionEntryMatcher( 'attributeA' ) )547 )548 completion_data = BuildRequest( filetype = 'dummy_filetype',549 contents = 'objectA.attr',550 line_num = 1,551 column_num = 12,552 file_data = {553 '/bar': {554 'contents': 'objectA = bar',555 'filetypes': [ 'dummy_filetype' ]556 }557 } )558 results = app.post_json( '/completions',559 completion_data ).json[ 'completions' ]560 assert_that(561 results,562 has_items( CompletionEntryMatcher( 'attributeB' ) )563 )564 # We ask for candidates twice because of cache invalidation:565 # both requests have the same cursor position and contents for the current566 # file but different contents for another file.567 assert_that( candidates_list.call_count, equal_to( 2 ) )568@SharedYcmd569@patch( 'ycmd.tests.test_utils.DummyCompleter.ShouldUseNowInner',570 return_value = True )571@patch( 'ycmd.tests.test_utils.DummyCompleter.CandidatesList',572 side_effect = [ [ 'attributeA' ], [ 'attributeB' ] ] )573def GetCompletions_CacheIsNotValid_DifferentExtraConfData_test(574 app, candidates_list, *args ):575 with PatchCompleter( DummyCompleter, 'dummy_filetype' ):576 completion_data = BuildRequest( filetype = 'dummy_filetype',577 contents = 'objectA.attr',578 line_num = 1,579 column_num = 12 )580 results = app.post_json( '/completions',581 completion_data ).json[ 'completions' ]582 assert_that(583 results,584 has_items( CompletionEntryMatcher( 'attributeA' ) )585 )586 completion_data = BuildRequest( filetype = 'dummy_filetype',587 contents = 'objectA.attr',588 line_num = 1,589 column_num = 12,590 extra_conf_data = { 'key': 'value' } )591 results = app.post_json( '/completions',592 completion_data ).json[ 'completions' ]593 assert_that(594 results,595 has_items( CompletionEntryMatcher( 'attributeB' ) )596 )597 # We ask for candidates twice because of cache invalidation:598 # both requests are identical except the extra conf data.599 assert_that( candidates_list.call_count, equal_to( 2 ) )600@SharedYcmd601@patch( 'ycmd.tests.test_utils.DummyCompleter.ShouldUseNowInner',602 return_value = True )603@patch( 'ycmd.tests.test_utils.DummyCompleter.CandidatesList',604 return_value = [ 'aba', 'cbc' ] )605def GetCompletions_FilterThenReturnFromCache_test( app,606 candidates_list,607 *args ):608 with PatchCompleter( DummyCompleter, 'dummy_filetype' ):609 # First, fill the cache with an empty query610 completion_data = BuildRequest( filetype = 'dummy_filetype',611 contents = 'objectA.',612 line_num = 1,613 column_num = 9 )614 results = app.post_json( '/completions',615 completion_data ).json[ 'completions' ]616 assert_that( results,617 has_items( CompletionEntryMatcher( 'aba' ),618 CompletionEntryMatcher( 'cbc' ) ) )619 # Now, filter them. This causes them to be converted to bytes and back620 completion_data = BuildRequest( filetype = 'dummy_filetype',621 contents = 'objectA.c',622 line_num = 1,623 column_num = 10 )624 results = app.post_json( '/completions',625 completion_data ).json[ 'completions' ]626 assert_that( results,627 has_items( CompletionEntryMatcher( 'cbc' ) ) )628 # Finally, request the original (unfiltered) set again. Ensure that we get629 # proper results (not some bytes objects)630 completion_data = BuildRequest( filetype = 'dummy_filetype',631 contents = 'objectA.',632 line_num = 1,633 column_num = 9 )634 results = app.post_json( '/completions',635 completion_data ).json[ 'completions' ]636 assert_that( results,637 has_items( CompletionEntryMatcher( 'aba' ),638 CompletionEntryMatcher( 'cbc' ) ) )...

Full Screen

Full Screen

test_queue.py

Source:test_queue.py Github

copy

Full Screen

...15from xivo_dao.tests.test_dao import DAOTestCase16class TestOptions(DAOTestCase):17 def test_getter(self):18 queue = self.add_queue(timeout=5)19 assert_that(queue.options, has_item(has_items('timeout', '5')))20 def test_getter_default_values(self):21 queue = self.add_queue()22 assert_that(queue.options, contains_inanyorder(23 has_items('timeout', '0'),24 has_items('ringinuse', 'no'),25 has_items('reportholdtime', 'no'),26 has_items('timeoutrestart', 'no'),27 has_items('timeoutpriority', 'app'),28 has_items('autofill', 'yes'),29 has_items('autopause', 'no'),30 has_items('setinterfacevar', 'no'),31 has_items('setqueueentryvar', 'no'),32 has_items('setqueuevar', 'no'),33 has_items('min-announce-frequency', '60'),34 has_items('random-periodic-announce', 'no'),35 has_items('announce-position', 'yes'),36 has_items('announce-position-limit', '5'),37 ))38 def test_getter_exclude_columns(self):39 queue = self.add_queue(40 name='name',41 category='queue',42 commented='1',43 musicclass='musicclass',44 )45 assert_that(queue.options, all_of(46 not_(has_items(has_item('name'))),47 not_(has_items(has_item('category'))),48 not_(has_items(has_item('commented'))),49 not_(has_items(has_item('musicclass'))),50 ))51 def test_getter_custom_columns(self):52 queue = self.add_queue()53 assert_that(queue.options, all_of(54 not_(has_items(has_item('enabled'))),55 not_(has_items(has_item('ring_in_use'))),56 ))57 def test_getter_integer_values(self):58 queue = self.add_queue()59 assert_that(queue.options, has_items(60 has_items('ringinuse', 'no'),61 has_items('reportholdtime', 'no'),62 has_items('timeoutrestart', 'no'),63 has_items('autofill', 'yes'),64 has_items('setinterfacevar', 'no'),65 has_items('setqueueentryvar', 'no'),66 has_items('setqueuevar', 'no'),67 has_items('random-periodic-announce', 'no'),68 ))69 def test_setter(self):70 queue = self.add_queue(defaultrule='111')71 queue.options = [['defaultrule', '222']]72 self.session.flush()73 self.session.expire_all()74 assert_that(queue.defaultrule, equal_to('222'))75 def test_setter_default_values(self):76 queue = self.add_queue(77 timeout=10,78 ringinuse=10,79 reportholdtime=1,80 timeoutrestart=10,81 timeoutpriority='toto',...

Full Screen

Full Screen

test_db_token.py

Source:test_db_token.py Github

copy

Full Screen

...66 ) = self._token_dao.delete_expired_tokens_and_sessions()67 assert_that(68 expired_tokens,69 all_of(70 not_(has_items(has_entries(uuid=token_1['uuid']))),71 has_items(has_entries(uuid=token_2['uuid'])),72 has_items(has_entries(uuid=token_3['uuid'])),73 ),74 )75 assert_that(76 expired_sessions,77 all_of(78 not_(has_items(has_entries(uuid=token_1['session_uuid']))),79 has_items(has_entries(uuid=token_2['session_uuid'])),80 has_items(has_entries(uuid=token_3['session_uuid'])),81 ),82 )83 sessions = self.session.query(models.Session).all()84 assert_that(85 sessions,86 all_of(87 has_items(has_properties(uuid=token_1['session_uuid'])),88 not_(has_items(has_properties(uuid=token_2['session_uuid']))),89 not_(has_items(has_properties(uuid=token_3['session_uuid']))),90 ),91 )92 tokens = self.session.query(models.Token).all()93 assert_that(94 tokens,95 all_of(96 has_items(has_properties(uuid=token_1['uuid'])),97 not_(has_items(has_properties(uuid=token_2['uuid']))),98 not_(has_items(has_properties(uuid=token_3['uuid']))),99 ),...

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