How to use host_add_labels method in autotest

Best Python code snippet using autotest_python

host_unittest.py

Source:host_unittest.py Github

copy

Full Screen

1#!/usr/bin/python2#3# Copyright 2008 Google Inc. All Rights Reserved.4"""Test for host."""5import unittest6import os7import sys8try:9 import autotest.common as common10except ImportError:11 import common12from autotest.cli import cli_mock, host13class host_ut(cli_mock.cli_unittest):14 def test_parse_lock_options_both_set(self):15 hh = host.host()16 class opt(object):17 lock = True18 unlock = True19 options = opt()20 self.usage = "unused"21 sys.exit.expect_call(1).and_raises(cli_mock.ExitException)22 self.god.mock_io()23 self.assertRaises(cli_mock.ExitException,24 hh._parse_lock_options, options)25 self.god.unmock_io()26 def test_cleanup_labels_with_platform(self):27 labels = ['l0', 'l1', 'l2', 'p0', 'l3']28 hh = host.host()29 self.assertEqual(['l0', 'l1', 'l2', 'l3'],30 hh._cleanup_labels(labels, 'p0'))31 def test_cleanup_labels_no_platform(self):32 labels = ['l0', 'l1', 'l2', 'l3']33 hh = host.host()34 self.assertEqual(['l0', 'l1', 'l2', 'l3'],35 hh._cleanup_labels(labels))36 def test_cleanup_labels_with_non_avail_platform(self):37 labels = ['l0', 'l1', 'l2', 'l3']38 hh = host.host()39 self.assertEqual(['l0', 'l1', 'l2', 'l3'],40 hh._cleanup_labels(labels, 'p0'))41class host_list_unittest(cli_mock.cli_unittest):42 def test_parse_host_not_required(self):43 hl = host.host_list()44 sys.argv = ['atest']45 (options, leftover) = hl.parse()46 self.assertEqual([], hl.hosts)47 self.assertEqual([], leftover)48 def test_parse_with_hosts(self):49 hl = host.host_list()50 mfile = cli_mock.create_file('host0\nhost3\nhost4\n')51 sys.argv = ['atest', 'host1', '--mlist', mfile.name, 'host3']52 (options, leftover) = hl.parse()53 self.assertEqualNoOrder(['host0', 'host1', 'host3', 'host4'],54 hl.hosts)55 self.assertEqual(leftover, [])56 mfile.clean()57 def test_parse_with_labels(self):58 hl = host.host_list()59 sys.argv = ['atest', '--label', 'label0']60 (options, leftover) = hl.parse()61 self.assertEqual(['label0'], hl.labels)62 self.assertEqual(leftover, [])63 def test_parse_with_multi_labels(self):64 hl = host.host_list()65 sys.argv = ['atest', '--label', 'label0,label2']66 (options, leftover) = hl.parse()67 self.assertEqualNoOrder(['label0', 'label2'], hl.labels)68 self.assertEqual(leftover, [])69 def test_parse_with_escaped_commas_label(self):70 hl = host.host_list()71 sys.argv = ['atest', '--label', 'label\\,0']72 (options, leftover) = hl.parse()73 self.assertEqual(['label,0'], hl.labels)74 self.assertEqual(leftover, [])75 def test_parse_with_escaped_commas_multi_labels(self):76 hl = host.host_list()77 sys.argv = ['atest', '--label', 'label\\,0,label\\,2']78 (options, leftover) = hl.parse()79 self.assertEqualNoOrder(['label,0', 'label,2'], hl.labels)80 self.assertEqual(leftover, [])81 def test_parse_with_both(self):82 hl = host.host_list()83 mfile = cli_mock.create_file('host0\nhost3\nhost4\n')84 sys.argv = ['atest', 'host1', '--mlist', mfile.name, 'host3',85 '--label', 'label0']86 (options, leftover) = hl.parse()87 self.assertEqualNoOrder(['host0', 'host1', 'host3', 'host4'],88 hl.hosts)89 self.assertEqual(['label0'], hl.labels)90 self.assertEqual(leftover, [])91 mfile.clean()92 def test_execute_list_all_no_labels(self):93 self.run_cmd(argv=['atest', 'host', 'list', '--ignore_site_file'],94 rpcs=[('get_hosts', {},95 True,96 [{u'status': u'Ready',97 u'hostname': u'host0',98 u'locked': False,99 u'locked_by': 'user0',100 u'lock_time': u'2008-07-23 12:54:15',101 u'labels': [],102 u'invalid': False,103 u'synch_id': None,104 u'platform': None,105 u'id': 1},106 {u'status': u'Ready',107 u'hostname': u'host1',108 u'locked': True,109 u'locked_by': 'user0',110 u'lock_time': u'2008-07-23 12:54:15',111 u'labels': [u'plat1'],112 u'invalid': False,113 u'synch_id': None,114 u'platform': u'plat1',115 u'id': 2}])],116 out_words_ok=['host0', 'host1', 'Ready',117 'plat1', 'False', 'True'])118 def test_execute_list_all_with_labels(self):119 self.run_cmd(argv=['atest', 'host', 'list', '--ignore_site_file'],120 rpcs=[('get_hosts', {},121 True,122 [{u'status': u'Ready',123 u'hostname': u'host0',124 u'locked': False,125 u'locked_by': 'user0',126 u'lock_time': u'2008-07-23 12:54:15',127 u'labels': [u'label0', u'label1'],128 u'invalid': False,129 u'synch_id': None,130 u'platform': None,131 u'id': 1},132 {u'status': u'Ready',133 u'hostname': u'host1',134 u'locked': True,135 u'locked_by': 'user0',136 u'lock_time': u'2008-07-23 12:54:15',137 u'labels': [u'label2', u'label3', u'plat1'],138 u'invalid': False,139 u'synch_id': None,140 u'platform': u'plat1',141 u'id': 2}])],142 out_words_ok=['host0', 'host1', 'Ready', 'plat1',143 'label0', 'label1', 'label2', 'label3',144 'False', 'True'])145 def test_execute_list_filter_one_host(self):146 self.run_cmd(argv=['atest', 'host', 'list', 'host1',147 '--ignore_site_file'],148 rpcs=[('get_hosts', {'hostname__in': ['host1']},149 True,150 [{u'status': u'Ready',151 u'hostname': u'host1',152 u'locked': True,153 u'locked_by': 'user0',154 u'lock_time': u'2008-07-23 12:54:15',155 u'labels': [u'label2', u'label3', u'plat1'],156 u'invalid': False,157 u'synch_id': None,158 u'platform': u'plat1',159 u'id': 2}])],160 out_words_ok=['host1', 'Ready', 'plat1',161 'label2', 'label3', 'True'],162 out_words_no=['host0', 'host2',163 'label1', 'label4', 'False'])164 def test_execute_list_filter_two_hosts(self):165 mfile = cli_mock.create_file('host2')166 self.run_cmd(argv=['atest', 'host', 'list', 'host1',167 '--mlist', mfile.name, '--ignore_site_file'],168 # This is a bit fragile as the list order may change...169 rpcs=[('get_hosts', {'hostname__in': ['host2', 'host1']},170 True,171 [{u'status': u'Ready',172 u'hostname': u'host1',173 u'locked': True,174 u'locked_by': 'user0',175 u'lock_time': u'2008-07-23 12:54:15',176 u'labels': [u'label2', u'label3', u'plat1'],177 u'invalid': False,178 u'synch_id': None,179 u'platform': u'plat1',180 u'id': 2},181 {u'status': u'Ready',182 u'hostname': u'host2',183 u'locked': True,184 u'locked_by': 'user0',185 u'lock_time': u'2008-07-23 12:54:15',186 u'labels': [u'label3', u'label4', u'plat1'],187 u'invalid': False,188 u'synch_id': None,189 u'platform': u'plat1',190 u'id': 3}])],191 out_words_ok=['host1', 'Ready', 'plat1',192 'label2', 'label3', 'True',193 'host2', 'label4'],194 out_words_no=['host0', 'label1', 'False'])195 mfile.clean()196 def test_execute_list_filter_two_hosts_one_not_found(self):197 mfile = cli_mock.create_file('host2')198 self.run_cmd(argv=['atest', 'host', 'list', 'host1',199 '--mlist', mfile.name, '--ignore_site_file'],200 # This is a bit fragile as the list order may change...201 rpcs=[('get_hosts', {'hostname__in': ['host2', 'host1']},202 True,203 [{u'status': u'Ready',204 u'hostname': u'host2',205 u'locked': True,206 u'locked_by': 'user0',207 u'lock_time': u'2008-07-23 12:54:15',208 u'labels': [u'label3', u'label4', u'plat1'],209 u'invalid': False,210 u'synch_id': None,211 u'platform': u'plat1',212 u'id': 3}])],213 out_words_ok=['Ready', 'plat1',214 'label3', 'label4', 'True'],215 out_words_no=['host1', 'False'],216 err_words_ok=['host1'])217 mfile.clean()218 def test_execute_list_filter_two_hosts_none_found(self):219 self.run_cmd(argv=['atest', 'host', 'list',220 'host1', 'host2', '--ignore_site_file'],221 # This is a bit fragile as the list order may change...222 rpcs=[('get_hosts', {'hostname__in': ['host2', 'host1']},223 True,224 [])],225 out_words_ok=[],226 out_words_no=['Hostname', 'Status'],227 err_words_ok=['Unknown', 'host1', 'host2'])228 def test_execute_list_filter_label(self):229 self.run_cmd(argv=['atest', 'host', 'list',230 '-b', 'label3', '--ignore_site_file'],231 rpcs=[('get_hosts', {'labels__name__in': ['label3']},232 True,233 [{u'status': u'Ready',234 u'hostname': u'host1',235 u'locked': True,236 u'locked_by': 'user0',237 u'lock_time': u'2008-07-23 12:54:15',238 u'labels': [u'label2', u'label3', u'plat1'],239 u'invalid': False,240 u'synch_id': None,241 u'platform': u'plat1',242 u'id': 2},243 {u'status': u'Ready',244 u'hostname': u'host2',245 u'locked': True,246 u'locked_by': 'user0',247 u'lock_time': u'2008-07-23 12:54:15',248 u'labels': [u'label3', u'label4', u'plat1'],249 u'invalid': False,250 u'synch_id': None,251 u'platform': u'plat1',252 u'id': 3}])],253 out_words_ok=['host1', 'Ready', 'plat1',254 'label2', 'label3', 'True',255 'host2', 'label4'],256 out_words_no=['host0', 'label1', 'False'])257 def test_execute_list_filter_multi_labels(self):258 self.run_cmd(argv=['atest', 'host', 'list',259 '-b', 'label3,label2', '--ignore_site_file'],260 rpcs=[('get_hosts', {'multiple_labels': ['label2',261 'label3']},262 True,263 [{u'status': u'Ready',264 u'hostname': u'host1',265 u'locked': True,266 u'locked_by': 'user0',267 u'lock_time': u'2008-07-23 12:54:15',268 u'labels': [u'label2', u'label3', u'plat0'],269 u'invalid': False,270 u'synch_id': None,271 u'platform': u'plat0',272 u'id': 2},273 {u'status': u'Ready',274 u'hostname': u'host3',275 u'locked': True,276 u'locked_by': 'user0',277 u'lock_time': u'2008-07-23 12:54:15',278 u'labels': [u'label3', u'label2', u'plat2'],279 u'invalid': False,280 u'synch_id': None,281 u'platform': u'plat2',282 u'id': 4}])],283 out_words_ok=['host1', 'host3', 'Ready', 'plat0',284 'label2', 'label3', 'plat2'],285 out_words_no=['host2', 'label4', 'False', 'plat1'])286 def test_execute_list_filter_three_labels(self):287 self.run_cmd(argv=['atest', 'host', 'list',288 '-b', 'label3,label2, label4',289 '--ignore_site_file'],290 rpcs=[('get_hosts', {'multiple_labels': ['label2',291 'label3',292 'label4']},293 True,294 [{u'status': u'Ready',295 u'hostname': u'host2',296 u'locked': True,297 u'locked_by': 'user0',298 u'lock_time': u'2008-07-23 12:54:15',299 u'labels': [u'label3', u'label2', u'label4',300 u'plat1'],301 u'invalid': False,302 u'synch_id': None,303 u'platform': u'plat1',304 u'id': 3}])],305 out_words_ok=['host2', 'plat1',306 'label2', 'label3', 'label4'],307 out_words_no=['host1', 'host3'])308 def test_execute_list_filter_wild_labels(self):309 self.run_cmd(argv=['atest', 'host', 'list',310 '-b', 'label*',311 '--ignore_site_file'],312 rpcs=[('get_hosts',313 {'labels__name__startswith': 'label'},314 True,315 [{u'status': u'Ready',316 u'hostname': u'host2',317 u'locked': 1,318 u'locked_by': 'user0',319 u'lock_time': u'2008-07-23 12:54:15',320 u'labels': [u'label3', u'label2', u'label4',321 u'plat1'],322 u'invalid': 0,323 u'synch_id': None,324 u'platform': u'plat1',325 u'id': 3}])],326 out_words_ok=['host2', 'plat1',327 'label2', 'label3', 'label4'],328 out_words_no=['host1', 'host3'])329 def test_execute_list_filter_multi_labels_no_results(self):330 self.run_cmd(argv=['atest', 'host', 'list',331 '-b', 'label3,label2, ', '--ignore_site_file'],332 rpcs=[('get_hosts', {'multiple_labels': ['label2',333 'label3']},334 True,335 [])],336 out_words_ok=[],337 out_words_no=['host1', 'host2', 'host3',338 'label2', 'label3', 'label4'])339 def test_execute_list_filter_label_and_hosts(self):340 self.run_cmd(argv=['atest', 'host', 'list', 'host1',341 '-b', 'label3', 'host2', '--ignore_site_file'],342 rpcs=[('get_hosts', {'labels__name__in': ['label3'],343 'hostname__in': ['host2', 'host1']},344 True,345 [{u'status': u'Ready',346 u'hostname': u'host1',347 u'locked': True,348 u'locked_by': 'user0',349 u'lock_time': u'2008-07-23 12:54:15',350 u'labels': [u'label2', u'label3', u'plat1'],351 u'invalid': False,352 u'synch_id': None,353 u'platform': u'plat1',354 u'id': 2},355 {u'status': u'Ready',356 u'hostname': u'host2',357 u'locked': True,358 u'locked_by': 'user0',359 u'lock_time': u'2008-07-23 12:54:15',360 u'labels': [u'label3', u'label4', u'plat1'],361 u'invalid': False,362 u'synch_id': None,363 u'platform': u'plat1',364 u'id': 3}])],365 out_words_ok=['host1', 'Ready', 'plat1',366 'label2', 'label3', 'True',367 'host2', 'label4'],368 out_words_no=['host0', 'label1', 'False'])369 def test_execute_list_filter_label_and_hosts_none(self):370 self.run_cmd(argv=['atest', 'host', 'list', 'host1',371 '-b', 'label3', 'host2', '--ignore_site_file'],372 rpcs=[('get_hosts', {'labels__name__in': ['label3'],373 'hostname__in': ['host2', 'host1']},374 True,375 [])],376 out_words_ok=[],377 out_words_no=['Hostname', 'Status'],378 err_words_ok=['Unknown', 'host1', 'host2'])379 def test_execute_list_filter_status(self):380 self.run_cmd(argv=['atest', 'host', 'list',381 '-s', 'Ready', '--ignore_site_file'],382 rpcs=[('get_hosts', {'status__in': ['Ready']},383 True,384 [{u'status': u'Ready',385 u'hostname': u'host1',386 u'locked': True,387 u'locked_by': 'user0',388 u'lock_time': u'2008-07-23 12:54:15',389 u'labels': [u'label2', u'label3', u'plat1'],390 u'invalid': False,391 u'synch_id': None,392 u'platform': u'plat1',393 u'id': 2},394 {u'status': u'Ready',395 u'hostname': u'host2',396 u'locked': True,397 u'locked_by': 'user0',398 u'lock_time': u'2008-07-23 12:54:15',399 u'labels': [u'label3', u'label4', u'plat1'],400 u'invalid': False,401 u'synch_id': None,402 u'platform': u'plat1',403 u'id': 3}])],404 out_words_ok=['host1', 'Ready', 'plat1',405 'label2', 'label3', 'True',406 'host2', 'label4'],407 out_words_no=['host0', 'label1', 'False'])408 def test_execute_list_filter_status_and_hosts(self):409 self.run_cmd(argv=['atest', 'host', 'list', 'host1',410 '-s', 'Ready', 'host2', '--ignore_site_file'],411 rpcs=[('get_hosts', {'status__in': ['Ready'],412 'hostname__in': ['host2', 'host1']},413 True,414 [{u'status': u'Ready',415 u'hostname': u'host1',416 u'locked': True,417 u'locked_by': 'user0',418 u'lock_time': u'2008-07-23 12:54:15',419 u'labels': [u'label2', u'label3', u'plat1'],420 u'invalid': False,421 u'synch_id': None,422 u'platform': u'plat1',423 u'id': 2},424 {u'status': u'Ready',425 u'hostname': u'host2',426 u'locked': True,427 u'locked_by': 'user0',428 u'lock_time': u'2008-07-23 12:54:15',429 u'labels': [u'label3', u'label4', u'plat1'],430 u'invalid': False,431 u'synch_id': None,432 u'platform': u'plat1',433 u'id': 3}])],434 out_words_ok=['host1', 'Ready', 'plat1',435 'label2', 'label3', 'True',436 'host2', 'label4'],437 out_words_no=['host0', 'label1', 'False'])438 def test_execute_list_filter_status_and_hosts_none(self):439 self.run_cmd(argv=['atest', 'host', 'list', 'host1',440 '--status', 'Repair',441 'host2', '--ignore_site_file'],442 rpcs=[('get_hosts', {'status__in': ['Repair'],443 'hostname__in': ['host2', 'host1']},444 True,445 [])],446 out_words_ok=[],447 out_words_no=['Hostname', 'Status'],448 err_words_ok=['Unknown', 'host2'])449 def test_execute_list_filter_statuses_and_hosts_none(self):450 self.run_cmd(argv=['atest', 'host', 'list', 'host1',451 '--status', 'Repair',452 'host2', '--ignore_site_file'],453 rpcs=[('get_hosts', {'status__in': ['Repair'],454 'hostname__in': ['host2', 'host1']},455 True,456 [])],457 out_words_ok=[],458 out_words_no=['Hostname', 'Status'],459 err_words_ok=['Unknown', 'host2'])460 def test_execute_list_filter_locked(self):461 self.run_cmd(argv=['atest', 'host', 'list', 'host1',462 '--locked', 'host2', '--ignore_site_file'],463 rpcs=[('get_hosts', {'locked': True,464 'hostname__in': ['host2', 'host1']},465 True,466 [{u'status': u'Ready',467 u'hostname': u'host1',468 u'locked': True,469 u'locked_by': 'user0',470 u'lock_time': u'2008-07-23 12:54:15',471 u'labels': [u'label2', u'label3', u'plat1'],472 u'invalid': False,473 u'synch_id': None,474 u'platform': u'plat1',475 u'id': 2},476 {u'status': u'Ready',477 u'hostname': u'host2',478 u'locked': True,479 u'locked_by': 'user0',480 u'lock_time': u'2008-07-23 12:54:15',481 u'labels': [u'label3', u'label4', u'plat1'],482 u'invalid': False,483 u'synch_id': None,484 u'platform': u'plat1',485 u'id': 3}])],486 out_words_ok=['host1', 'Ready', 'plat1',487 'label2', 'label3', 'True',488 'host2', 'label4'],489 out_words_no=['host0', 'label1', 'False'])490 def test_execute_list_filter_unlocked(self):491 self.run_cmd(argv=['atest', 'host', 'list',492 '--unlocked', '--ignore_site_file'],493 rpcs=[('get_hosts', {'locked': False},494 True,495 [{u'status': u'Ready',496 u'hostname': u'host1',497 u'locked': False,498 u'locked_by': 'user0',499 u'lock_time': u'2008-07-23 12:54:15',500 u'labels': [u'label2', u'label3', u'plat1'],501 u'invalid': False,502 u'synch_id': None,503 u'platform': u'plat1',504 u'id': 2},505 {u'status': u'Ready',506 u'hostname': u'host2',507 u'locked': False,508 u'locked_by': 'user0',509 u'lock_time': u'2008-07-23 12:54:15',510 u'labels': [u'label3', u'label4', u'plat1'],511 u'invalid': False,512 u'synch_id': None,513 u'platform': u'plat1',514 u'id': 3}])],515 out_words_ok=['host1', 'Ready', 'plat1',516 'label2', 'label3', 'False',517 'host2', 'label4'],518 out_words_no=['host0', 'label1', 'True'])519class host_stat_unittest(cli_mock.cli_unittest):520 def test_execute_stat_two_hosts(self):521 # The order of RPCs between host1 and host0 could change...522 self.run_cmd(argv=['atest', 'host', 'stat', 'host0', 'host1',523 '--ignore_site_file'],524 rpcs=[('get_hosts', {'hostname': 'host1'},525 True,526 [{u'status': u'Ready',527 u'hostname': u'host1',528 u'locked': True,529 u'lock_time': u'2008-07-23 12:54:15',530 u'locked_by': 'user0',531 u'protection': 'No protection',532 u'labels': [u'label3', u'label4', u'plat1'],533 u'invalid': False,534 u'synch_id': None,535 u'platform': u'plat1',536 u'id': 3}]),537 ('get_hosts', {'hostname': 'host0'},538 True,539 [{u'status': u'Ready',540 u'hostname': u'host0',541 u'locked': False,542 u'locked_by': 'user0',543 u'lock_time': u'2008-07-23 12:54:15',544 u'protection': u'No protection',545 u'labels': [u'label0', u'plat0'],546 u'invalid': False,547 u'synch_id': None,548 u'platform': u'plat0',549 u'id': 2}]),550 ('get_acl_groups', {'hosts__hostname': 'host1'},551 True,552 [{u'description': u'',553 u'hosts': [u'host0', u'host1'],554 u'id': 1,555 u'name': u'Everyone',556 u'users': [u'user2', u'debug_user', u'user0']}]),557 ('get_labels', {'host__hostname': 'host1'},558 True,559 [{u'id': 2,560 u'platform': 1,561 u'name': u'jme',562 u'invalid': False,563 u'kernel_config': u''}]),564 ('get_acl_groups', {'hosts__hostname': 'host0'},565 True,566 [{u'description': u'',567 u'hosts': [u'host0', u'host1'],568 u'id': 1,569 u'name': u'Everyone',570 u'users': [u'user0', u'debug_user']},571 {u'description': u'myacl0',572 u'hosts': [u'host0'],573 u'id': 2,574 u'name': u'acl0',575 u'users': [u'user0']}]),576 ('get_labels', {'host__hostname': 'host0'},577 True,578 [{u'id': 4,579 u'platform': 0,580 u'name': u'label0',581 u'invalid': False,582 u'kernel_config': u''},583 {u'id': 5,584 u'platform': 1,585 u'name': u'plat0',586 u'invalid': False,587 u'kernel_config': u''}])],588 out_words_ok=['host0', 'host1', 'plat0', 'plat1',589 'Everyone', 'acl0', 'label0'])590 def test_execute_stat_one_bad_host_verbose(self):591 self.run_cmd(argv=['atest', 'host', 'stat', 'host0',592 'host1', '-v', '--ignore_site_file'],593 rpcs=[('get_hosts', {'hostname': 'host1'},594 True,595 []),596 ('get_hosts', {'hostname': 'host0'},597 True,598 [{u'status': u'Ready',599 u'hostname': u'host0',600 u'locked': False,601 u'locked_by': 'user0',602 u'lock_time': u'2008-07-23 12:54:15',603 u'protection': u'No protection',604 u'labels': [u'label0', u'plat0'],605 u'invalid': False,606 u'synch_id': None,607 u'platform': u'plat0',608 u'id': 2}]),609 ('get_acl_groups', {'hosts__hostname': 'host0'},610 True,611 [{u'description': u'',612 u'hosts': [u'host0', u'host1'],613 u'id': 1,614 u'name': u'Everyone',615 u'users': [u'user0', u'debug_user']},616 {u'description': u'myacl0',617 u'hosts': [u'host0'],618 u'id': 2,619 u'name': u'acl0',620 u'users': [u'user0']}]),621 ('get_labels', {'host__hostname': 'host0'},622 True,623 [{u'id': 4,624 u'platform': 0,625 u'name': u'label0',626 u'invalid': False,627 u'kernel_config': u''},628 {u'id': 5,629 u'platform': 1,630 u'name': u'plat0',631 u'invalid': False,632 u'kernel_config': u''}])],633 out_words_ok=['host0', 'plat0',634 'Everyone', 'acl0', 'label0'],635 out_words_no=['host1'],636 err_words_ok=['host1', 'Unknown host'],637 err_words_no=['host0'])638 def test_execute_stat_one_bad_host(self):639 self.run_cmd(argv=['atest', 'host', 'stat', 'host0', 'host1',640 '--ignore_site_file'],641 rpcs=[('get_hosts', {'hostname': 'host1'},642 True,643 []),644 ('get_hosts', {'hostname': 'host0'},645 True,646 [{u'status': u'Ready',647 u'hostname': u'host0',648 u'locked': False,649 u'locked_by': 'user0',650 u'lock_time': u'2008-07-23 12:54:15',651 u'protection': u'No protection',652 u'labels': [u'label0', u'plat0'],653 u'invalid': False,654 u'synch_id': None,655 u'platform': u'plat0',656 u'id': 2}]),657 ('get_acl_groups', {'hosts__hostname': 'host0'},658 True,659 [{u'description': u'',660 u'hosts': [u'host0', u'host1'],661 u'id': 1,662 u'name': u'Everyone',663 u'users': [u'user0', u'debug_user']},664 {u'description': u'myacl0',665 u'hosts': [u'host0'],666 u'id': 2,667 u'name': u'acl0',668 u'users': [u'user0']}]),669 ('get_labels', {'host__hostname': 'host0'},670 True,671 [{u'id': 4,672 u'platform': 0,673 u'name': u'label0',674 u'invalid': False,675 u'kernel_config': u''},676 {u'id': 5,677 u'platform': 1,678 u'name': u'plat0',679 u'invalid': False,680 u'kernel_config': u''}])],681 out_words_ok=['host0', 'plat0',682 'Everyone', 'acl0', 'label0'],683 out_words_no=['host1'],684 err_words_ok=['host1', 'Unknown host'],685 err_words_no=['host0'])686 def test_execute_stat_wildcard(self):687 # The order of RPCs between host1 and host0 could change...688 self.run_cmd(argv=['atest', 'host', 'stat', 'ho*',689 '--ignore_site_file'],690 rpcs=[('get_hosts', {'hostname__startswith': 'ho'},691 True,692 [{u'status': u'Ready',693 u'hostname': u'host1',694 u'locked': True,695 u'lock_time': u'2008-07-23 12:54:15',696 u'locked_by': 'user0',697 u'protection': 'No protection',698 u'labels': [u'label3', u'label4', u'plat1'],699 u'invalid': False,700 u'synch_id': None,701 u'platform': u'plat1',702 u'id': 3},703 {u'status': u'Ready',704 u'hostname': u'host0',705 u'locked': False,706 u'locked_by': 'user0',707 u'lock_time': u'2008-07-23 12:54:15',708 u'protection': u'No protection',709 u'labels': [u'label0', u'plat0'],710 u'invalid': False,711 u'synch_id': None,712 u'platform': u'plat0',713 u'id': 2}]),714 ('get_acl_groups', {'hosts__hostname': 'host1'},715 True,716 [{u'description': u'',717 u'hosts': [u'host0', u'host1'],718 u'id': 1,719 u'name': u'Everyone',720 u'users': [u'user2', u'debug_user', u'user0']}]),721 ('get_labels', {'host__hostname': 'host1'},722 True,723 [{u'id': 2,724 u'platform': 1,725 u'name': u'jme',726 u'invalid': False,727 u'kernel_config': u''}]),728 ('get_acl_groups', {'hosts__hostname': 'host0'},729 True,730 [{u'description': u'',731 u'hosts': [u'host0', u'host1'],732 u'id': 1,733 u'name': u'Everyone',734 u'users': [u'user0', u'debug_user']},735 {u'description': u'myacl0',736 u'hosts': [u'host0'],737 u'id': 2,738 u'name': u'acl0',739 u'users': [u'user0']}]),740 ('get_labels', {'host__hostname': 'host0'},741 True,742 [{u'id': 4,743 u'platform': 0,744 u'name': u'label0',745 u'invalid': False,746 u'kernel_config': u''},747 {u'id': 5,748 u'platform': 1,749 u'name': u'plat0',750 u'invalid': False,751 u'kernel_config': u''}])],752 out_words_ok=['host0', 'host1', 'plat0', 'plat1',753 'Everyone', 'acl0', 'label0'])754 def test_execute_stat_wildcard_and_host(self):755 # The order of RPCs between host1 and host0 could change...756 self.run_cmd(argv=['atest', 'host', 'stat', 'ho*', 'newhost0',757 '--ignore_site_file'],758 rpcs=[('get_hosts', {'hostname': 'newhost0'},759 True,760 [{u'status': u'Ready',761 u'hostname': u'newhost0',762 u'locked': False,763 u'locked_by': 'user0',764 u'lock_time': u'2008-07-23 12:54:15',765 u'protection': u'No protection',766 u'labels': [u'label0', u'plat0'],767 u'invalid': False,768 u'synch_id': None,769 u'platform': u'plat0',770 u'id': 5}]),771 ('get_hosts', {'hostname__startswith': 'ho'},772 True,773 [{u'status': u'Ready',774 u'hostname': u'host1',775 u'locked': True,776 u'lock_time': u'2008-07-23 12:54:15',777 u'locked_by': 'user0',778 u'protection': 'No protection',779 u'labels': [u'label3', u'label4', u'plat1'],780 u'invalid': False,781 u'synch_id': None,782 u'platform': u'plat1',783 u'id': 3},784 {u'status': u'Ready',785 u'hostname': u'host0',786 u'locked': False,787 u'locked_by': 'user0',788 u'protection': 'No protection',789 u'lock_time': u'2008-07-23 12:54:15',790 u'labels': [u'label0', u'plat0'],791 u'invalid': False,792 u'synch_id': None,793 u'platform': u'plat0',794 u'id': 2}]),795 ('get_acl_groups', {'hosts__hostname': 'newhost0'},796 True,797 [{u'description': u'',798 u'hosts': [u'newhost0', 'host1'],799 u'id': 42,800 u'name': u'my_acl',801 u'users': [u'user0', u'debug_user']},802 {u'description': u'my favorite acl',803 u'hosts': [u'newhost0'],804 u'id': 2,805 u'name': u'acl10',806 u'users': [u'user0']}]),807 ('get_labels', {'host__hostname': 'newhost0'},808 True,809 [{u'id': 4,810 u'platform': 0,811 u'name': u'label0',812 u'invalid': False,813 u'kernel_config': u''},814 {u'id': 5,815 u'platform': 1,816 u'name': u'plat0',817 u'invalid': False,818 u'kernel_config': u''}]),819 ('get_acl_groups', {'hosts__hostname': 'host1'},820 True,821 [{u'description': u'',822 u'hosts': [u'host0', u'host1'],823 u'id': 1,824 u'name': u'Everyone',825 u'users': [u'user2', u'debug_user', u'user0']}]),826 ('get_labels', {'host__hostname': 'host1'},827 True,828 [{u'id': 2,829 u'platform': 1,830 u'name': u'jme',831 u'invalid': False,832 u'kernel_config': u''}]),833 ('get_acl_groups', {'hosts__hostname': 'host0'},834 True,835 [{u'description': u'',836 u'hosts': [u'host0', u'host1'],837 u'id': 1,838 u'name': u'Everyone',839 u'users': [u'user0', u'debug_user']},840 {u'description': u'myacl0',841 u'hosts': [u'host0'],842 u'id': 2,843 u'name': u'acl0',844 u'users': [u'user0']}]),845 ('get_labels', {'host__hostname': 'host0'},846 True,847 [{u'id': 4,848 u'platform': 0,849 u'name': u'label0',850 u'invalid': False,851 u'kernel_config': u''},852 {u'id': 5,853 u'platform': 1,854 u'name': u'plat0',855 u'invalid': False,856 u'kernel_config': u''}])],857 out_words_ok=['host0', 'host1', 'newhost0',858 'plat0', 'plat1',859 'Everyone', 'acl10', 'label0'])860class host_jobs_unittest(cli_mock.cli_unittest):861 def test_execute_jobs_one_host(self):862 self.run_cmd(argv=['atest', 'host', 'jobs', 'host0',863 '--ignore_site_file'],864 rpcs=[('get_host_queue_entries',865 {'host__hostname': 'host0', 'query_limit': 20,866 'sort_by': ['-job__id']},867 True,868 [{u'status': u'Failed',869 u'complete': 1,870 u'host': {u'status': u'Ready',871 u'locked': True,872 u'locked_by': 'user0',873 u'hostname': u'host0',874 u'invalid': False,875 u'id': 3232,876 u'synch_id': None},877 u'priority': 0,878 u'meta_host': u'meta0',879 u'job': {u'control_file':880 (u"def step_init():\n"881 "\tjob.next_step([step_test])\n"882 "\ttestkernel = job.kernel("883 "'kernel-smp-2.6.xyz.x86_64.rpm')\n"884 "\ttestkernel.install()\n"885 "\ttestkernel.boot()\n\n"886 "def step_test():\n"887 "\tjob.run_test('kernbench')\n\n"),888 u'name': u'kernel-smp-2.6.xyz.x86_64',889 u'control_type': u'Client',890 u'synchronizing': None,891 u'priority': u'Low',892 u'owner': u'user0',893 u'created_on': u'2008-01-09 10:45:12',894 u'synch_count': None,895 u'synch_type': u'Asynchronous',896 u'id': 216},897 u'active': 0,898 u'id': 2981},899 {u'status': u'Aborted',900 u'complete': 1,901 u'host': {u'status': u'Ready',902 u'locked': True,903 u'locked_by': 'user0',904 u'hostname': u'host0',905 u'invalid': False,906 u'id': 3232,907 u'synch_id': None},908 u'priority': 0,909 u'meta_host': None,910 u'job': {u'control_file':911 u"job.run_test('sleeptest')\n\n",912 u'name': u'testjob',913 u'control_type': u'Client',914 u'synchronizing': 0,915 u'priority': u'Low',916 u'owner': u'user1',917 u'created_on': u'2008-01-17 15:04:53',918 u'synch_count': None,919 u'synch_type': u'Asynchronous',920 u'id': 289},921 u'active': 0,922 u'id': 3167}])],923 out_words_ok=['216', 'user0', 'Failed',924 'kernel-smp-2.6.xyz.x86_64', 'Aborted',925 '289', 'user1', 'Aborted',926 'testjob'])927 def test_execute_jobs_wildcard(self):928 self.run_cmd(argv=['atest', 'host', 'jobs', 'ho*',929 '--ignore_site_file'],930 rpcs=[('get_hosts', {'hostname__startswith': 'ho'},931 True,932 [{u'status': u'Ready',933 u'hostname': u'host1',934 u'locked': True,935 u'lock_time': u'2008-07-23 12:54:15',936 u'locked_by': 'user0',937 u'labels': [u'label3', u'label4', u'plat1'],938 u'invalid': False,939 u'synch_id': None,940 u'platform': u'plat1',941 u'id': 3},942 {u'status': u'Ready',943 u'hostname': u'host0',944 u'locked': False,945 u'locked_by': 'user0',946 u'lock_time': u'2008-07-23 12:54:15',947 u'labels': [u'label0', u'plat0'],948 u'invalid': False,949 u'synch_id': None,950 u'platform': u'plat0',951 u'id': 2}]),952 ('get_host_queue_entries',953 {'host__hostname': 'host1', 'query_limit': 20,954 'sort_by': ['-job__id']},955 True,956 [{u'status': u'Failed',957 u'complete': 1,958 u'host': {u'status': u'Ready',959 u'locked': True,960 u'locked_by': 'user0',961 u'hostname': u'host1',962 u'invalid': False,963 u'id': 3232,964 u'synch_id': None},965 u'priority': 0,966 u'meta_host': u'meta0',967 u'job': {u'control_file':968 (u"def step_init():\n"969 "\tjob.next_step([step_test])\n"970 "\ttestkernel = job.kernel("971 "'kernel-smp-2.6.xyz.x86_64.rpm')\n"972 "\ttestkernel.install()\n"973 "\ttestkernel.boot()\n\n"974 "def step_test():\n"975 "\tjob.run_test('kernbench')\n\n"),976 u'name': u'kernel-smp-2.6.xyz.x86_64',977 u'control_type': u'Client',978 u'synchronizing': None,979 u'priority': u'Low',980 u'owner': u'user0',981 u'created_on': u'2008-01-09 10:45:12',982 u'synch_count': None,983 u'synch_type': u'Asynchronous',984 u'id': 216},985 u'active': 0,986 u'id': 2981},987 {u'status': u'Aborted',988 u'complete': 1,989 u'host': {u'status': u'Ready',990 u'locked': True,991 u'locked_by': 'user0',992 u'hostname': u'host1',993 u'invalid': False,994 u'id': 3232,995 u'synch_id': None},996 u'priority': 0,997 u'meta_host': None,998 u'job': {u'control_file':999 u"job.run_test('sleeptest')\n\n",1000 u'name': u'testjob',1001 u'control_type': u'Client',1002 u'synchronizing': 0,1003 u'priority': u'Low',1004 u'owner': u'user1',1005 u'created_on': u'2008-01-17 15:04:53',1006 u'synch_count': None,1007 u'synch_type': u'Asynchronous',1008 u'id': 289},1009 u'active': 0,1010 u'id': 3167}]),1011 ('get_host_queue_entries',1012 {'host__hostname': 'host0', 'query_limit': 20,1013 'sort_by': ['-job__id']},1014 True,1015 [{u'status': u'Failed',1016 u'complete': 1,1017 u'host': {u'status': u'Ready',1018 u'locked': True,1019 u'locked_by': 'user0',1020 u'hostname': u'host0',1021 u'invalid': False,1022 u'id': 3232,1023 u'synch_id': None},1024 u'priority': 0,1025 u'meta_host': u'meta0',1026 u'job': {u'control_file':1027 (u"def step_init():\n"1028 "\tjob.next_step([step_test])\n"1029 "\ttestkernel = job.kernel("1030 "'kernel-smp-2.6.xyz.x86_64.rpm')\n"1031 "\ttestkernel.install()\n"1032 "\ttestkernel.boot()\n\n"1033 "def step_test():\n"1034 "\tjob.run_test('kernbench')\n\n"),1035 u'name': u'kernel-smp-2.6.xyz.x86_64',1036 u'control_type': u'Client',1037 u'synchronizing': None,1038 u'priority': u'Low',1039 u'owner': u'user0',1040 u'created_on': u'2008-01-09 10:45:12',1041 u'synch_count': None,1042 u'synch_type': u'Asynchronous',1043 u'id': 216},1044 u'active': 0,1045 u'id': 2981},1046 {u'status': u'Aborted',1047 u'complete': 1,1048 u'host': {u'status': u'Ready',1049 u'locked': True,1050 u'locked_by': 'user0',1051 u'hostname': u'host0',1052 u'invalid': False,1053 u'id': 3232,1054 u'synch_id': None},1055 u'priority': 0,1056 u'meta_host': None,1057 u'job': {u'control_file':1058 u"job.run_test('sleeptest')\n\n",1059 u'name': u'testjob',1060 u'control_type': u'Client',1061 u'synchronizing': 0,1062 u'priority': u'Low',1063 u'owner': u'user1',1064 u'created_on': u'2008-01-17 15:04:53',1065 u'synch_count': None,1066 u'synch_type': u'Asynchronous',1067 u'id': 289},1068 u'active': 0,1069 u'id': 3167}])],1070 out_words_ok=['216', 'user0', 'Failed',1071 'kernel-smp-2.6.xyz.x86_64', 'Aborted',1072 '289', 'user1', 'Aborted',1073 'testjob'])1074 def test_execute_jobs_one_host_limit(self):1075 self.run_cmd(argv=['atest', 'host', 'jobs', 'host0',1076 '--ignore_site_file', '-q', '10'],1077 rpcs=[('get_host_queue_entries',1078 {'host__hostname': 'host0', 'query_limit': 10,1079 'sort_by': ['-job__id']},1080 True,1081 [{u'status': u'Failed',1082 u'complete': 1,1083 u'host': {u'status': u'Ready',1084 u'locked': True,1085 u'locked_by': 'user0',1086 u'hostname': u'host0',1087 u'invalid': False,1088 u'id': 3232,1089 u'synch_id': None},1090 u'priority': 0,1091 u'meta_host': u'meta0',1092 u'job': {u'control_file':1093 (u"def step_init():\n"1094 "\tjob.next_step([step_test])\n"1095 "\ttestkernel = job.kernel("1096 "'kernel-smp-2.6.xyz.x86_64.rpm')\n"1097 "\ttestkernel.install()\n"1098 "\ttestkernel.boot()\n\n"1099 "def step_test():\n"1100 "\tjob.run_test('kernbench')\n\n"),1101 u'name': u'kernel-smp-2.6.xyz.x86_64',1102 u'control_type': u'Client',1103 u'synchronizing': None,1104 u'priority': u'Low',1105 u'owner': u'user0',1106 u'created_on': u'2008-01-09 10:45:12',1107 u'synch_count': None,1108 u'synch_type': u'Asynchronous',1109 u'id': 216},1110 u'active': 0,1111 u'id': 2981},1112 {u'status': u'Aborted',1113 u'complete': 1,1114 u'host': {u'status': u'Ready',1115 u'locked': True,1116 u'locked_by': 'user0',1117 u'hostname': u'host0',1118 u'invalid': False,1119 u'id': 3232,1120 u'synch_id': None},1121 u'priority': 0,1122 u'meta_host': None,1123 u'job': {u'control_file':1124 u"job.run_test('sleeptest')\n\n",1125 u'name': u'testjob',1126 u'control_type': u'Client',1127 u'synchronizing': 0,1128 u'priority': u'Low',1129 u'owner': u'user1',1130 u'created_on': u'2008-01-17 15:04:53',1131 u'synch_count': None,1132 u'synch_type': u'Asynchronous',1133 u'id': 289},1134 u'active': 0,1135 u'id': 3167}])],1136 out_words_ok=['216', 'user0', 'Failed',1137 'kernel-smp-2.6.xyz.x86_64', 'Aborted',1138 '289', 'user1', 'Aborted',1139 'testjob'])1140class host_mod_unittest(cli_mock.cli_unittest):1141 def test_execute_lock_one_host(self):1142 self.run_cmd(argv=['atest', 'host', 'mod',1143 '--lock', 'host0', '--ignore_site_file'],1144 rpcs=[('modify_host', {'id': 'host0', 'locked': True},1145 True, None)],1146 out_words_ok=['Locked', 'host0'])1147 def test_execute_unlock_two_hosts(self):1148 self.run_cmd(argv=['atest', 'host', 'mod',1149 '-u', 'host0,host1', '--ignore_site_file'],1150 rpcs=[('modify_host', {'id': 'host1', 'locked': False},1151 True, None),1152 ('modify_host', {'id': 'host0', 'locked': False},1153 True, None)],1154 out_words_ok=['Unlocked', 'host0', 'host1'])1155 def test_execute_lock_unknown_hosts(self):1156 self.run_cmd(argv=['atest', 'host', 'mod',1157 '-l', 'host0,host1', 'host2', '--ignore_site_file'],1158 rpcs=[('modify_host', {'id': 'host2', 'locked': True},1159 True, None),1160 ('modify_host', {'id': 'host1', 'locked': True},1161 False, 'DoesNotExist: Host matching '1162 'query does not exist.'),1163 ('modify_host', {'id': 'host0', 'locked': True},1164 True, None)],1165 out_words_ok=['Locked', 'host0', 'host2'],1166 err_words_ok=['Host', 'matching', 'query', 'host1'])1167 def test_execute_protection_hosts(self):1168 mfile = cli_mock.create_file('host0\nhost1,host2\nhost3 host4')1169 self.run_cmd(argv=['atest', 'host', 'mod', '--protection',1170 'Do not repair',1171 'host5', '--mlist', mfile.name, 'host1', 'host6',1172 '--ignore_site_file'],1173 rpcs=[('modify_host', {'id': 'host6',1174 'protection': 'Do not repair'},1175 True, None),1176 ('modify_host', {'id': 'host5',1177 'protection': 'Do not repair'},1178 True, None),1179 ('modify_host', {'id': 'host4',1180 'protection': 'Do not repair'},1181 True, None),1182 ('modify_host', {'id': 'host3',1183 'protection': 'Do not repair'},1184 True, None),1185 ('modify_host', {'id': 'host2',1186 'protection': 'Do not repair'},1187 True, None),1188 ('modify_host', {'id': 'host1',1189 'protection': 'Do not repair'},1190 True, None),1191 ('modify_host', {'id': 'host0',1192 'protection': 'Do not repair'},1193 True, None)],1194 out_words_ok=['Do not repair', 'host0', 'host1', 'host2',1195 'host3', 'host4', 'host5', 'host6'])1196 mfile.clean()1197class host_create_unittest(cli_mock.cli_unittest):1198 def test_execute_create_muliple_hosts_all_options(self):1199 self.run_cmd(argv=['atest', 'host', 'create', '--lock',1200 '-b', 'label0', '--acls', 'acl0', 'host0', 'host1',1201 '--ignore_site_file'],1202 rpcs=[('get_labels', {'name': 'label0'},1203 True,1204 [{u'id': 4,1205 u'platform': 0,1206 u'name': u'label0',1207 u'invalid': False,1208 u'kernel_config': u''}]),1209 ('get_acl_groups', {'name': 'acl0'},1210 True, []),1211 ('add_acl_group', {'name': 'acl0'},1212 True, 5),1213 ('add_host', {'hostname': 'host1',1214 'status': 'Ready',1215 'locked': True},1216 True, 42),1217 ('host_add_labels', {'id': 'host1',1218 'labels': ['label0']},1219 True, None),1220 ('add_host', {'hostname': 'host0',1221 'status': 'Ready',1222 'locked': True},1223 True, 42),1224 ('host_add_labels', {'id': 'host0',1225 'labels': ['label0']},1226 True, None),1227 ('acl_group_add_hosts',1228 {'id': 'acl0', 'hosts': ['host1', 'host0']},1229 True, None)],1230 out_words_ok=['host0', 'host1'])1231 def test_execute_create_muliple_hosts_unlocked(self):1232 self.run_cmd(argv=['atest', 'host', 'create',1233 '-b', 'label0', '--acls', 'acl0', 'host0', 'host1',1234 '--ignore_site_file'],1235 rpcs=[('get_labels', {'name': 'label0'},1236 True,1237 [{u'id': 4,1238 u'platform': 0,1239 u'name': u'label0',1240 u'invalid': False,1241 u'kernel_config': u''}]),1242 ('get_acl_groups', {'name': 'acl0'},1243 True, []),1244 ('add_acl_group', {'name': 'acl0'},1245 True, 5),1246 ('add_host', {'hostname': 'host1',1247 'status': 'Ready',1248 'locked': True},1249 True, 42),1250 ('host_add_labels', {'id': 'host1',1251 'labels': ['label0']},1252 True, None),1253 ('add_host', {'hostname': 'host0',1254 'status': 'Ready',1255 'locked': True},1256 True, 42),1257 ('host_add_labels', {'id': 'host0',1258 'labels': ['label0']},1259 True, None),1260 ('acl_group_add_hosts',1261 {'id': 'acl0', 'hosts': ['host1', 'host0']},1262 True, None),1263 ('modify_host', {'id': 'host1', 'locked': False},1264 True, None),1265 ('modify_host', {'id': 'host0', 'locked': False},1266 True, None)],1267 out_words_ok=['host0', 'host1'])1268 def test_execute_create_muliple_hosts_label_escaped_quotes(self):1269 self.run_cmd(argv=['atest', 'host', 'create',1270 '-b', 'label0,label\\,1,label\\,2',1271 '--acls', 'acl0', 'host0', 'host1',1272 '--ignore_site_file'],1273 rpcs=[('get_labels', {'name': 'label0'},1274 True,1275 [{u'id': 4,1276 u'platform': 0,1277 u'name': u'label0',1278 u'invalid': False,1279 u'kernel_config': u''}]),1280 ('get_labels', {'name': 'label,1'},1281 True,1282 [{u'id': 4,1283 u'platform': 0,1284 u'name': u'label,1',1285 u'invalid': False,1286 u'kernel_config': u''}]),1287 ('get_labels', {'name': 'label,2'},1288 True,1289 [{u'id': 4,1290 u'platform': 0,1291 u'name': u'label,2',1292 u'invalid': False,1293 u'kernel_config': u''}]),1294 ('get_acl_groups', {'name': 'acl0'},1295 True, []),1296 ('add_acl_group', {'name': 'acl0'},1297 True, 5),1298 ('add_host', {'hostname': 'host1',1299 'status': 'Ready',1300 'locked': True},1301 True, 42),1302 ('host_add_labels', {'id': 'host1',1303 'labels': ['label0', 'label,1',1304 'label,2']},1305 True, None),1306 ('add_host', {'hostname': 'host0',1307 'status': 'Ready',1308 'locked': True},1309 True, 42),1310 ('host_add_labels', {'id': 'host0',1311 'labels': ['label0', 'label,1',1312 'label,2']},1313 True, None),1314 ('acl_group_add_hosts',1315 {'id': 'acl0', 'hosts': ['host1', 'host0']},1316 True, None),1317 ('modify_host', {'id': 'host1', 'locked': False},1318 True, None),1319 ('modify_host', {'id': 'host0', 'locked': False},1320 True, None)],1321 out_words_ok=['host0', 'host1'])1322if __name__ == '__main__':...

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