Best Python code snippet using autotest_python
models_test.py
Source:models_test.py
...34 def test_add_host_previous_one_time_host(self):35 # ensure that when adding a host which was previously used as a one-time36 # host, the status isn't reset, since this can interfere with the37 # scheduler.38 host = models.Host.create_one_time_host('othost')39 self.assertEquals(host.invalid, True)40 self.assertEquals(host.status, models.Host.Status.READY)41 host.status = models.Host.Status.RUNNING42 host.save()43 host2 = models.Host.add_object(hostname='othost')44 self.assertEquals(host2.id, host.id)45 self.assertEquals(host2.status, models.Host.Status.RUNNING)46 def test_check_board_labels_allowed(self):47 host = models.Host.create_one_time_host('othost')48 # First check with host with no board label.49 self.assertEqual(host.check_board_labels_allowed([host]), None)50 # Second check with host with board label51 label = models.Label.add_object(name='board:test')52 label.host_set.add(host)53 self.assertRaises(model_logic.ValidationError,54 host.check_board_labels_allowed, [host],55 ['board:new_board'])56class SpecialTaskUnittest(unittest.TestCase,57 frontend_test_utils.FrontendTestMixin):58 def setUp(self):59 self._frontend_common_setup()60 def tearDown(self):61 self._frontend_common_teardown()...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!