How to use assertEqualNoOrder method in autotest

Best Python code snippet using autotest_python

topic_common_unittest.py

Source:topic_common_unittest.py Github

copy

Full Screen

...31 parse_info = topic_common.item_parse_info32 test_parse_info = parse_info(attribute_name='testing',33 filename_option='flist')34 result, leftover = test_parse_info.get_values(options, [])35 self.assertEqualNoOrder(expected, result)36 os.unlink(options.flist)37 def __test_parsing_inline_good(self, options, expected):38 parse_info = topic_common.item_parse_info39 test_parse_info = parse_info(attribute_name='testing',40 inline_option='inline')41 result, leftover = test_parse_info.get_values(options, [])42 self.assertEqualNoOrder(expected, result)43 def __test_parsing_leftover_good(self, leftover, expected):44 class opt(object):45 pass46 parse_info = topic_common.item_parse_info47 test_parse_info = parse_info(attribute_name='testing',48 inline_option='inline',49 use_leftover=True)50 result, leftover = test_parse_info.get_values(opt(), leftover)51 self.assertEqualNoOrder(expected, result)52 def __test_parsing_all_good(self, options, leftover, expected):53 parse_info = topic_common.item_parse_info54 test_parse_info = parse_info(attribute_name='testing',55 inline_option='inline',56 filename_option='flist',57 use_leftover=True)58 result, leftover = test_parse_info.get_values(options, leftover)59 self.assertEqualNoOrder(expected, result)60 os.unlink(options.flist)61 def __test_parsing_all_bad(self, options, leftover):62 parse_info = topic_common.item_parse_info63 test_parse_info = parse_info(attribute_name='testing',64 inline_option='inline',65 filename_option='flist',66 use_leftover=True)67 self.assertRaises(topic_common.CliError,68 test_parse_info.get_values, options, leftover)69 def test_file_list_wrong_file(self):70 class opt(object):71 flist = './does_not_exist'72 self.__test_parsing_flist_bad(opt())73 def test_file_list_empty_file(self):74 class opt(object):75 flist_obj = cli_mock.create_file('')76 flist = flist_obj.name77 self.__test_parsing_flist_bad(opt())78 def test_file_list_ok(self):79 class opt(object):80 flist_obj = cli_mock.create_file('a\nb\nc\n')81 flist = flist_obj.name82 self.__test_parsing_flist_good(opt(), ['a', 'b', 'c'])83 def test_file_list_one_line_space(self):84 class opt(object):85 flist_obj = cli_mock.create_file('a b c\nd e\nf\n')86 flist = flist_obj.name87 self.__test_parsing_flist_good(opt(), ['a', 'b', 'c', 'd', 'e', 'f'])88 def test_file_list_one_line_comma(self):89 class opt(object):90 flist_obj = cli_mock.create_file('a,b,c\nd,e\nf\n')91 flist = flist_obj.name92 self.__test_parsing_flist_good(opt(), ['a', 'b', 'c', 'd', 'e', 'f'])93 def test_file_list_one_line_mix(self):94 class opt(object):95 flist_obj = cli_mock.create_file('a,b c\nd,e\nf\ng h,i')96 flist = flist_obj.name97 self.__test_parsing_flist_good(opt(), ['a', 'b', 'c', 'd', 'e',98 'f', 'g', 'h', 'i'])99 def test_file_list_one_line_comma_space(self):100 class opt(object):101 flist_obj = cli_mock.create_file('a, b c\nd,e\nf\ng h,i')102 flist = flist_obj.name103 self.__test_parsing_flist_good(opt(), ['a', 'b', 'c', 'd', 'e',104 'f', 'g', 'h', 'i'])105 def test_file_list_line_end_comma_space(self):106 class opt(object):107 flist_obj = cli_mock.create_file('a, b c\nd,e, \nf,\ng h,i ,')108 flist = flist_obj.name109 self.__test_parsing_flist_good(opt(), ['a', 'b', 'c', 'd', 'e',110 'f', 'g', 'h', 'i'])111 def test_file_list_no_eof(self):112 class opt(object):113 flist_obj = cli_mock.create_file('a\nb\nc')114 flist = flist_obj.name115 self.__test_parsing_flist_good(opt(), ['a', 'b', 'c'])116 def test_file_list_blank_line(self):117 class opt(object):118 flist_obj = cli_mock.create_file('\na\nb\n\nc\n')119 flist = flist_obj.name120 self.__test_parsing_flist_good(opt(), ['a', 'b', 'c'])121 def test_file_list_escaped_commas(self):122 class opt(object):123 flist_obj = cli_mock.create_file('a\nb\\,c\\,d\nef\\,g')124 flist = flist_obj.name125 self.__test_parsing_flist_good(opt(), ['a', 'b,c,d', 'ef,g'])126 def test_file_list_escaped_commas_slashes(self):127 class opt(object):128 flist_obj = cli_mock.create_file('a\nb\\\\\\,c\\,d\nef\\\\,g')129 flist = flist_obj.name130 self.__test_parsing_flist_good(opt(), ['a', 'b\\,c,d', 'ef\\', 'g'])131 def test_file_list_opt_list_one(self):132 class opt(object):133 inline = 'a'134 self.__test_parsing_inline_good(opt(), ['a'])135 def test_file_list_opt_list_space(self):136 class opt(object):137 inline = 'a b c'138 self.__test_parsing_inline_good(opt(), ['a', 'b', 'c'])139 def test_file_list_opt_list_mix_space_comma(self):140 class opt(object):141 inline = 'a b,c,d e'142 self.__test_parsing_inline_good(opt(), ['a', 'b', 'c', 'd', 'e'])143 def test_file_list_opt_list_mix_comma_space(self):144 class opt(object):145 inline = 'a b,c, d e'146 self.__test_parsing_inline_good(opt(), ['a', 'b', 'c', 'd', 'e'])147 def test_file_list_opt_list_end_comma_space(self):148 class opt(object):149 inline = 'a b, ,c,, d e, '150 self.__test_parsing_inline_good(opt(), ['a', 'b', 'c', 'd', 'e'])151 def test_file_list_opt_list_escaped_commas(self):152 class opt(object):153 inline = 'a\\,b,c, d'154 self.__test_parsing_inline_good(opt(), ['a,b', 'c', 'd'])155 def test_file_list_opt_list_escaped_commas_slashes(self):156 class opt(object):157 inline = 'a\\,b\\\\\\,c,d,e'158 self.__test_parsing_inline_good(opt(), ['a,b\\,c', 'd', 'e'])159 def test_file_list_add_on_space(self):160 self.__test_parsing_leftover_good(['a','c','b'],161 ['a', 'b', 'c'])162 def test_file_list_add_on_mix_space_comma(self):163 self.__test_parsing_leftover_good(['a', 'c','b,d'],164 ['a', 'b', 'c', 'd'])165 def test_file_list_add_on_mix_comma_space(self):166 self.__test_parsing_leftover_good(['a', 'c', 'b,', 'd'],167 ['a', 'b', 'c', 'd'])168 def test_file_list_add_on_end_comma_space(self):169 self.__test_parsing_leftover_good(['a', 'c', 'b,', 'd,', ','],170 ['a', 'b', 'c', 'd'])171 def test_file_list_add_on_escaped_commas(self):172 self.__test_parsing_leftover_good(['a', 'c', 'b,', 'd\\,e\\,f'],173 ['a', 'b', 'c', 'd,e,f'])174 def test_file_list_add_on_escaped_commas_slashes(self):175 self.__test_parsing_leftover_good(['a', 'c', 'b,', 'd\\\\\\,e,f'],176 ['a', 'b', 'c', 'd\\,e', 'f'])177 def test_file_list_all_opt(self):178 class opt(object):179 flist_obj = cli_mock.create_file('f\ng\nh\n')180 flist = flist_obj.name181 inline = 'a b,c,d e'182 self.__test_parsing_all_good(opt(), ['i', 'j'],183 ['a', 'b', 'c', 'd', 'e',184 'f', 'g', 'h', 'i', 'j'])185 def test_file_list_all_opt_empty_file(self):186 class opt(object):187 flist_obj = cli_mock.create_file('')188 flist = flist_obj.name189 inline = 'a b,c,d e'190 self.__test_parsing_all_bad(opt(), ['i', 'j'])191 def test_file_list_all_opt_in_common(self):192 class opt(object):193 flist_obj = cli_mock.create_file('f\nc\na\n')194 flist = flist_obj.name195 inline = 'a b,c,d e'196 self.__test_parsing_all_good(opt(), ['i','j,d'],197 ['a', 'b', 'c', 'd', 'e', 'f', 'i', 'j'])198 def test_file_list_all_opt_in_common_space(self):199 class opt(object):200 flist_obj = cli_mock.create_file('a b c\nd,e\nf\ng')201 flist = flist_obj.name202 inline = 'a b,c,d h'203 self.__test_parsing_all_good(opt(), ['i','j,d'],204 ['a', 'b', 'c', 'd', 'e',205 'f', 'g', 'h', 'i', 'j'])206 def test_file_list_all_opt_in_common_weird(self):207 class opt(object):208 flist_obj = cli_mock.create_file('a b c\nd,e\nf\ng, \n, ,,')209 flist = flist_obj.name210 inline = 'a b,c,d h, , ,, '211 self.__test_parsing_all_good(opt(), ['i','j,d'],212 ['a', 'b', 'c', 'd', 'e',213 'f', 'g', 'h', 'i', 'j'])214 def test_file_list_all_opt_in_common_escaped_commas(self):215 class opt(object):216 flist_obj = cli_mock.create_file('a\\,b\\,c\nd,e\nf\ng')217 flist = flist_obj.name218 inline = 'a\\,b\\,c,d h'219 self.__test_parsing_all_good(opt(), ['i','j,d'],220 ['a,b,c', 'd', 'e', 'f', 'g', 'h',221 'i', 'j'])222 def test_file_list_all_opt_in_common_escaped_commas_slashes(self):223 class opt(object):224 flist_obj = cli_mock.create_file('a\\,b\\\\\\,c\nd,e\nf,ghi, ,, j,')225 flist = flist_obj.name226 inline = 'a\\,b\\\\\\,c,d h,ijk'227 self.__test_parsing_all_good(opt(), ['i','j,d'],228 ['a,b\\,c', 'd', 'e', 'f', 'ghi', 'h',229 'i', 'j', 'ijk'])230class atest_unittest(cli_mock.cli_unittest):231 def setUp(self):232 super(atest_unittest, self).setUp()233 self.atest = topic_common.atest()234 self.atest.afe = rpc.afe_comm()235 if 'AUTOTEST_WEB' in os.environ:236 del os.environ['AUTOTEST_WEB']237 def tearDown(self):238 self.atest = None239 super(atest_unittest, self).tearDown()240 def test_invalid_arg_kill(self):241 self.atest.kill_on_failure = True242 self.god.mock_io()243 sys.exit.expect_call(1).and_raises(cli_mock.ExitException)244 self.assertRaises(cli_mock.ExitException,245 self.atest.invalid_arg, 'This is bad')246 (output, err) = self.god.unmock_io()247 self.god.check_playback()248 self.assert_(err.find('This is bad') >= 0)249 def test_invalid_arg_continue(self):250 self.god.mock_io()251 self.atest.invalid_arg('This is sort of ok')252 (output, err) = self.god.unmock_io()253 self.assert_(err.find('This is sort of ok') >= 0)254 def test_failure_continue(self):255 self.atest.failure('This is partly bad', item='item0',256 what_failed='something important')257 err = self.atest.failed['something important']258 self.assert_('This is partly bad' in err.keys())259 def test_failure_continue_multiple_different_errors(self):260 self.atest.failure('This is partly bad', item='item0',261 what_failed='something important')262 self.atest.failure('This is really bad', item='item0',263 what_failed='something really important')264 err = self.atest.failed['something important']265 self.assert_('This is partly bad' in err)266 self.assert_('This is really bad' not in err)267 err = self.atest.failed['something really important']268 self.assert_('This is partly bad' not in err)269 self.assert_('This is really bad' in err)270 def test_failure_continue_multiple_same_errors(self):271 self.atest.failure('This is partly bad', item='item0',272 what_failed='something important')273 self.atest.failure('This is really bad', item='item1',274 what_failed='something important')275 errs = self.atest.failed['something important']276 self.assert_('This is partly bad' in errs)277 self.assert_('This is really bad' in errs)278 self.assert_(set(['item0']) in errs.values())279 self.assert_(set(['item1']) in errs.values())280 def test_failure_continue_multiple_errors_mixed(self):281 self.atest.failure('This is partly bad', item='item0',282 what_failed='something important')283 self.atest.failure('This is really bad', item='item0',284 what_failed='something really important')285 self.atest.failure('This is really bad', item='item1',286 what_failed='something important')287 errs = self.atest.failed['something important']288 self.assert_('This is partly bad' in errs)289 self.assert_('This is really bad' in errs)290 self.assert_(set(['item0']) in errs.values())291 self.assert_(set(['item1']) in errs.values())292 errs = self.atest.failed['something really important']293 self.assert_('This is really bad' in errs)294 self.assert_('This is partly bad' not in errs)295 self.assert_(set(['item0']) in errs.values())296 self.assert_(set(['item1']) not in errs.values())297 def test_failure_continue_multiple_errors_mixed_same_error(self):298 self.atest.failure('This is partly bad', item='item0',299 what_failed='something important')300 self.atest.failure('This is really bad', item='item0',301 what_failed='something really important')302 self.atest.failure('This is partly bad', item='item1',303 what_failed='something important')304 errs = self.atest.failed['something important']305 self.assert_('This is partly bad' in errs)306 self.assert_('This is really bad' not in errs)307 self.assert_(set(['item0', 'item1']) in errs.values())308 errs = self.atest.failed['something really important']309 self.assert_('This is really bad' in errs)310 self.assert_('This is partly bad' not in errs)311 self.assert_(set(['item0']) in errs.values())312 self.assert_(set(['item1']) not in errs.values())313 def test_failure_exit(self):314 self.atest.kill_on_failure = True315 self.god.mock_io()316 sys.exit.expect_call(1).and_raises(cli_mock.ExitException)317 self.assertRaises(cli_mock.ExitException,318 self.atest.failure, 'This is partly bad')319 (output, err) = self.god.unmock_io()320 self.god.check_playback()321 self.assert_(err.find('This is partly bad') >= 0)322 def test_failure_exit_item(self):323 self.atest.kill_on_failure = True324 self.god.mock_io()325 sys.exit.expect_call(1).and_raises(cli_mock.ExitException)326 self.assertRaises(cli_mock.ExitException,327 self.atest.failure, 'This is partly bad',328 item='item0')329 (output, err) = self.god.unmock_io()330 self.god.check_playback()331 self.assertWords(err, ['This is partly bad'], ['item0'])332 def test_show_all_failures_common(self):333 self.atest.failure('This is partly bad', item='item0',334 what_failed='something important')335 self.atest.failure('This is partly bad', item='item1',336 what_failed='something important')337 self.god.mock_io()338 self.atest.show_all_failures()339 (output, err) = self.god.unmock_io()340 self.assertWords(err, ['something important',341 'This is partly bad', 'item0', 'item1'])342 def test_parse_add_on(self):343 flist = cli_mock.create_file('host1\nhost2\nleft2')344 sys.argv = ['atest', '--web', 'fooweb', '--parse',345 '--kill-on-failure', 'left1', 'left2', '-M', flist.name]346 self.atest.parser.add_option('-M', '--mlist', type='string')347 item_info = topic_common.item_parse_info(attribute_name='hosts',348 filename_option='mlist',349 use_leftover=True)350 (options, leftover) = self.atest.parse([item_info])351 self.assertEqualNoOrder(self.atest.hosts,352 ['left1', 'left2', 'host1', 'host2'])353 self.assertEqual({'mlist': flist.name,354 'web_server': 'fooweb',355 'parse': True,356 'parse_delim': '|',357 'kill_on_failure': True,358 'verbose': False,359 'no_confirmation': False,360 'debug': False}, options)361 self.assertEqual(leftover, [])362 flist.clean()363 def test_parse_no_add_on(self):364 flist = cli_mock.create_file('host1\nhost2\nleft2')365 sys.argv = ['atest', '--web', 'fooweb', '--parse', '-g',366 '--kill-on-failure', 'left1', 'left2', '-M', flist.name]367 self.atest.parser.add_option('-M', '--mlist', type='string')368 item_info = topic_common.item_parse_info(attribute_name='hosts',369 filename_option='mlist')370 (options, leftover) = self.atest.parse([item_info])371 self.assertEqualNoOrder(self.atest.hosts,372 ['left2', 'host1', 'host2'])373 self.assertEqual({'mlist': flist.name,374 'web_server': 'fooweb',375 'parse': True,376 'parse_delim': '|',377 'kill_on_failure': True,378 'verbose': False,379 'no_confirmation': False,380 'debug': True}, options)381 self.assertEqual(leftover, ['left1', 'left2'])382 flist.clean()383 def test_parse_add_on_first(self):384 flist = cli_mock.create_file('host1\nhost2\nleft2')385 ulist = cli_mock.create_file('user1\nuser2\nuser3\n')386 sys.argv = ['atest', '-g', '--parse', '--ulist', ulist.name,387 '-u', 'myuser,youruser',388 '--kill-on-failure', 'left1', 'left2', '-M', flist.name]389 self.atest.parser.add_option('-M', '--mlist', type='string')390 self.atest.parser.add_option('-U', '--ulist', type='string')391 self.atest.parser.add_option('-u', '--user', type='string')392 host_info = topic_common.item_parse_info(attribute_name='hosts',393 filename_option='mlist',394 use_leftover=True)395 user_info = topic_common.item_parse_info(attribute_name='users',396 inline_option='user',397 filename_option='ulist')398 (options, leftover) = self.atest.parse([host_info, user_info])399 self.assertEqualNoOrder(self.atest.hosts,400 ['left1', 'left2', 'host1', 'host2'])401 self.assertEqualNoOrder(self.atest.users,402 ['user1', 'user2', 'user3',403 'myuser', 'youruser'])404 self.assertEqual({'mlist': flist.name,405 'ulist': ulist.name,406 'user': 'myuser,youruser',407 'web_server': None,408 'parse': True,409 'parse_delim': '|',410 'kill_on_failure': True,411 'verbose': False,412 'no_confirmation': False,413 'debug': True}, options)414 self.assertEqual(leftover, [])415 flist.clean()416 ulist.clean()417 def test_parse_add_on_second(self):418 flist = cli_mock.create_file('host1\nhost2\nleft2')419 ulist = cli_mock.create_file('user1\nuser2\nuser3\n')420 sys.argv = ['atest', '-g', '--parse', '-U', ulist.name,421 '-u', 'myuser,youruser',422 '--kill-on-failure', 'left1', 'left2', '-M', flist.name]423 self.atest.parser.add_option('-M', '--mlist', type='string')424 self.atest.parser.add_option('-U', '--ulist', type='string')425 self.atest.parser.add_option('-u', '--user', type='string')426 host_info = topic_common.item_parse_info(attribute_name='hosts',427 filename_option='mlist',428 use_leftover=True)429 user_info = topic_common.item_parse_info(attribute_name='users',430 inline_option='user',431 filename_option='ulist')432 (options, leftover) = self.atest.parse([host_info, user_info])433 self.assertEqualNoOrder(self.atest.hosts,434 ['left1', 'left2', 'host1', 'host2'])435 self.assertEqualNoOrder(self.atest.users,436 ['user1', 'user2', 'user3',437 'myuser', 'youruser'])438 self.assertEqual({'mlist': flist.name,439 'ulist': ulist.name,440 'user': 'myuser,youruser',441 'web_server': None,442 'parse': True,443 'parse_delim': '|',444 'kill_on_failure': True,445 'verbose': False,446 'no_confirmation': False,447 'debug': True}, options)448 self.assertEqual(leftover, [])449 flist.clean()450 ulist.clean()451 def test_parse_all_opts(self):452 flist = cli_mock.create_file('host1\nhost2\nleft2')453 ulist = cli_mock.create_file('user1\nuser2\nuser3\n')454 sys.argv = ['atest', '-g', '--parse', '--ulist', ulist.name,455 '-u', 'myuser,youruser',456 '--kill-on-failure', '-M', flist.name, 'left1', 'left2']457 self.atest.parser.add_option('-M', '--mlist', type='string')458 self.atest.parser.add_option('-U', '--ulist', type='string')459 self.atest.parser.add_option('-u', '--user', type='string')460 host_info = topic_common.item_parse_info(attribute_name='hosts',461 filename_option='mlist',462 use_leftover=True)463 user_info = topic_common.item_parse_info(attribute_name='users',464 inline_option='user',465 filename_option='ulist')466 (options, leftover) = self.atest.parse([host_info, user_info])467 self.assertEqualNoOrder(self.atest.hosts,468 ['left1', 'left2', 'host1', 'host2'])469 self.assertEqualNoOrder(self.atest.users,470 ['user1', 'user2', 'user3',471 'myuser', 'youruser'])472 self.assertEqual({'mlist': flist.name,473 'ulist': ulist.name,474 'user': 'myuser,youruser',475 'web_server': None,476 'parse': True,477 'parse_delim': '|',478 'kill_on_failure': True,479 'verbose': False,480 'no_confirmation': False,481 'debug': True}, options)482 self.assertEqual(leftover, [])483 flist.clean()484 ulist.clean()485 def test_parse_no_add_on_2(self):486 flist = cli_mock.create_file('host1\nhost2\nleft2')487 ulist = cli_mock.create_file('user1\nuser2\nuser3\n')488 sys.argv = ['atest', '-U', ulist.name,489 '--kill-on-failure', '-M', flist.name]490 self.atest.parser.add_option('-M', '--mlist', type='string')491 self.atest.parser.add_option('-U', '--ulist', type='string')492 self.atest.parser.add_option('-u', '--user', type='string')493 host_info = topic_common.item_parse_info(attribute_name='hosts',494 filename_option='mlist',495 use_leftover=True)496 user_info = topic_common.item_parse_info(attribute_name='users',497 inline_option='user',498 filename_option='ulist')499 (options, leftover) = self.atest.parse([host_info, user_info])500 self.assertEqualNoOrder(self.atest.hosts,501 ['left2', 'host1', 'host2'])502 self.assertEqualNoOrder(self.atest.users,503 ['user1', 'user2', 'user3'])504 self.assertEqual({'mlist': flist.name,505 'ulist': ulist.name,506 'user': None,507 'web_server': None,508 'parse': False,509 'parse_delim': '|',510 'kill_on_failure': True,511 'verbose': False,512 'no_confirmation': False,513 'debug': False}, options)514 self.assertEqual(leftover, [])515 flist.clean()516 ulist.clean()517 def test_parse_no_flist_add_on(self):518 sys.argv = ['atest', '-g', '--parse', '-u', 'myuser,youruser',519 '--kill-on-failure', 'left1', 'left2']520 self.atest.parser.add_option('-M', '--mlist', type='string')521 self.atest.parser.add_option('-U', '--ulist', type='string')522 self.atest.parser.add_option('-u', '--user', type='string')523 host_info = topic_common.item_parse_info(attribute_name='hosts',524 use_leftover=True)525 user_info = topic_common.item_parse_info(attribute_name='users',526 inline_option='user')527 (options, leftover) = self.atest.parse([host_info, user_info])528 self.assertEqualNoOrder(self.atest.hosts,529 ['left1', 'left2'])530 self.assertEqualNoOrder(self.atest.users,531 ['myuser', 'youruser'])532 self.assertEqual({'mlist': None,533 'ulist': None,534 'user': 'myuser,youruser',535 'web_server': None,536 'parse': True,537 'parse_delim': '|',538 'kill_on_failure': True,539 'verbose': False,540 'no_confirmation': False,541 'debug': True}, options)542 self.assertEqual(leftover, [])543 def test_parse_no_flist_no_add_on(self):544 sys.argv = ['atest', '-u', 'myuser,youruser', '--kill-on-failure',545 '-a', 'acl1,acl2']546 self.atest.parser.add_option('-u', '--user', type='string')547 self.atest.parser.add_option('-a', '--acl', type='string')548 acl_info = topic_common.item_parse_info(attribute_name='acls',549 inline_option='acl')550 user_info = topic_common.item_parse_info(attribute_name='users',551 inline_option='user')552 (options, leftover) = self.atest.parse([user_info, acl_info])553 self.assertEqualNoOrder(self.atest.acls,554 ['acl1', 'acl2'])555 self.assertEqualNoOrder(self.atest.users,556 ['myuser', 'youruser'])557 self.assertEqual({'user': 'myuser,youruser',558 'acl': 'acl1,acl2',559 'web_server': None,560 'parse': False,561 'parse_delim': '|',562 'kill_on_failure': True,563 'verbose': False,564 'no_confirmation': False,565 'debug': False}, options)566 self.assertEqual(leftover, [])567 def test_parse_req_items_ok(self):568 sys.argv = ['atest', '-u', 'myuser,youruser']569 self.atest.parser.add_option('-u', '--user', type='string')570 user_info = topic_common.item_parse_info(attribute_name='users',571 inline_option='user')572 (options, leftover) = self.atest.parse([user_info],573 req_items='users')574 self.assertEqualNoOrder(self.atest.users,575 ['myuser', 'youruser'])576 self.assertEqual({'user': 'myuser,youruser',577 'web_server': None,578 'parse': False,579 'parse_delim': '|',580 'kill_on_failure': False,581 'verbose': False,582 'no_confirmation': False,583 'debug': False}, options)584 self.assertEqual(leftover, [])585 def test_parse_req_items_missing(self):586 sys.argv = ['atest', '-u', 'myuser,youruser', '--kill-on-failure']587 self.atest.parser.add_option('-u', '--user', type='string')588 acl_info = topic_common.item_parse_info(attribute_name='acls',589 inline_option='acl')590 user_info = topic_common.item_parse_info(attribute_name='users',591 inline_option='user')592 self.god.mock_io()593 sys.exit.expect_call(1).and_raises(cli_mock.ExitException)594 self.assertRaises(cli_mock.ExitException,595 self.atest.parse,596 [user_info, acl_info],597 'acls')598 self.assertEqualNoOrder(self.atest.users,599 ['myuser', 'youruser'])600 self.assertEqualNoOrder(self.atest.acls, [])601 self.god.check_playback()602 self.god.unmock_io()603 def test_parse_bad_option(self):604 sys.argv = ['atest', '--unknown']605 self.god.stub_function(self.atest.parser, 'error')606 self.atest.parser.error.expect_call('no such option: --unknown').and_return(None)607 self.atest.parse()608 self.god.check_playback()609 def test_parse_all_set(self):610 sys.argv = ['atest', '--web', 'fooweb', '--parse', '--debug',611 '--kill-on-failure', '--verbose', 'left1', 'left2',612 '--parse-delim', '?']613 (options, leftover) = self.atest.parse()614 self.assertEqual({'web_server': 'fooweb',...

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