Best Python code snippet using autotest_python
drone_manager_unittest.py
Source:drone_manager_unittest.py
...96 def test_choose_drone_for_execution_all_full_same_percentage_capacity(self):97 drone = self._test_choose_drone_for_execution_helper([(5, 3), (10, 6)],98 1)99 self.assertEquals(drone.name, 1)100 def test_user_restrictions(self):101 # this drone is restricted to a different user102 self.manager._enqueue_drone(MockDrone(1, max_processes=10,103 allowed_users=['fakeuser']))104 # this drone is allowed but has lower capacity105 self.manager._enqueue_drone(MockDrone(2, max_processes=2,106 allowed_users=[self._USERNAME]))107 self.assertEquals(2,108 self.manager.max_runnable_processes(self._USERNAME,109 None))110 drone = self.manager._choose_drone_for_execution(111 1, username=self._USERNAME, drone_hostnames_allowed=None)112 self.assertEquals(drone.name, 2)113 def test_user_restrictions_with_full_drone(self):114 # this drone is restricted to a different user...
test_user_restrictions.py
Source:test_user_restrictions.py
1from brownie import *2import brownie3def test_user_restrictions(deployer, contract):4 user = accounts[4] # random account5 q = contract.q()6 questions = ['Ethereum or Bitcoin?' for x in range(q)]7 correct_answers = [1 for x in range(10)]8 starting_time = chain.time() + 6*609 ending_time = starting_time + 3600 # ends after one hour10 user_answers = [1, 1, 1, 1, 1, 3, 3, 3, 3, 3]11 # only admin is allowed to add new POK tests12 with brownie.reverts("Ownable: caller is not the owner"):13 contract.addTest(starting_time, ending_time, {"from": user})14 # add POK test15 contract.addTest(starting_time, ending_time, {"from": deployer})16 # owner must not be able to add questions 5 mins before test starting time17 with brownie.reverts("Too Early"):...
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!!