How to use platform_and_labels method in autotest

Best Python code snippet using autotest_python

scheduler_models_unittest.py

Source:scheduler_models_unittest.py Github

copy

Full Screen

...132 def test_platform_and_labels_with_respect(self):133 scheduler_models.RESPECT_STATIC_LABELS = True134 test_host = self._setup_static_labels()135 host = scheduler_models.Host(id=test_host.id)136 platform, all_labels = host.platform_and_labels()137 self.assertEqual(platform, 'static_platform')138 self.assertNotIn('no_reference_label', all_labels)139 self.assertEqual(all_labels, ['non_static_label', 'static_platform'])140 def test_platform_and_labels_without_respect(self):141 scheduler_models.RESPECT_STATIC_LABELS = False142 test_host = self._setup_static_labels()143 host = scheduler_models.Host(id=test_host.id)144 platform, all_labels = host.platform_and_labels()145 self.assertIsNone(platform)146 self.assertEqual(all_labels, ['non_static_label', 'static_platform'])147 def test_cmp_for_sort(self):148 expected_order = [149 'alice', 'Host1', 'host2', 'host3', 'host09', 'HOST010',150 'host10', 'host11', 'yolkfolk']151 hostname_idx = list(scheduler_models.Host._fields).index('hostname')152 row = [None] * len(scheduler_models.Host._fields)153 hosts = []154 for hostname in expected_order:155 row[hostname_idx] = hostname156 hosts.append(scheduler_models.Host(row=row, new_record=True))157 host1 = hosts[expected_order.index('Host1')]158 host010 = hosts[expected_order.index('HOST010')]...

Full Screen

Full Screen

rdb_hosts_unittest.py

Source:rdb_hosts_unittest.py Github

copy

Full Screen

...80 self.db_helper.create_host(81 'h1', deps=set(label_names + [platform_name])))82 client_host = rdb_hosts.RDBClientHostWrapper(83 **server_host.wire_format())84 platform, labels = client_host.platform_and_labels()85 self.assertTrue(platform == platform_name)86 self.assertTrue(set(labels) == set(label_names))87 def testClientUpdateSave(self):88 """Test that a client host is capable of saving its attributes.89 Create a client host, set its attributes and verify that the attributes90 are saved properly by recreating a server host and checking them.91 @raises AssertionError: If the server host has the wrong attributes.92 """93 hostname = 'h1'94 db_host = self.db_helper.create_host(hostname, leased=True)95 server_host_dict = rdb_hosts.RDBServerHostWrapper(db_host).wire_format()96 client_host = rdb_hosts.RDBClientHostWrapper(**server_host_dict)97 host_data = {'hostname': hostname, 'id': db_host.id}98 default_values = rdb_models.AbstractHostModel.provide_default_values(...

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