How to use _test_post_helper method in autotest

Best Python code snippet using autotest_python

resources_test.py

Source:resources_test.py Github

copy

Full Screen

...250 def test_queue_entries(self):251 job = self.request('get', 'jobs/1')252 entries = self.request('get', job['queue_entries']['href'])253 self.check_collection(entries, ['host', 'hostname'], ['host1', 'host2'])254 def _test_post_helper(self, owner):255 data = {'name': 'myjob',256 'execution_info': {'control_file': self.CONTROL_FILE_CONTENTS,257 'is_server': True},258 'owner': owner,259 'drone_set': models.DroneSet.default_drone_set_name(),260 'queue_entries':261 [{'host': {'href': self.URI_PREFIX + '/hosts/host1'}},262 {'host': {'href': self.URI_PREFIX + '/hosts/host2'}}]}263 response = self.request('post', 'jobs', data=data)264 self.assertEquals(response, self.URI_PREFIX + '/jobs/3')265 job = models.Job.objects.get(id=3)266 self.assertEquals(job.name, 'myjob')267 self.assertEquals(job.control_file, self.CONTROL_FILE_CONTENTS)268 self.assertEquals(job.control_type, control_data.CONTROL_TYPE.SERVER)269 entries = job.hostqueueentry_set.order_by('host__hostname')270 self.assertEquals(entries[0].host.hostname, 'host1')271 self.assertEquals(entries[1].host.hostname, 'host2')272 owner_test = owner273 if not owner_test:274 owner_test = models.User.current_user().login275 self.assertEquals(job.owner, owner_test)276 def test_post_no_owner(self):277 self._test_post_helper(None)278 def test_post_with_owner(self):279 self._test_post_helper('job_owner')280class DirectoryTest(AfeResourceTestCase):281 def test_get(self):282 response = self.request('get', '')283 for key in ('atomic_group_classes', 'labels', 'users', 'acl_groups',284 'hosts', 'tests', 'jobs', 'execution_info',285 'queue_entries_request'):286 self.assert_(key in response)287if __name__ == '__main__':...

Full Screen

Full Screen

resources_unittest.py

Source:resources_unittest.py Github

copy

Full Screen

...247 def test_queue_entries(self):248 job = self.request('get', 'jobs/1')249 entries = self.request('get', job['queue_entries']['href'])250 self.check_collection(entries, ['host', 'hostname'], ['host1', 'host2'])251 def _test_post_helper(self, owner):252 data = {'name': 'myjob',253 'execution_info': {'control_file': self.CONTROL_FILE_CONTENTS,254 'is_server': True},255 'owner': owner,256 'drone_set': models.DroneSet.default_drone_set_name(),257 'queue_entries':258 [{'host': {'href': self.URI_PREFIX + '/hosts/host1'}},259 {'host': {'href': self.URI_PREFIX + '/hosts/host2'}}]}260 response = self.request('post', 'jobs', data=data)261 self.assertEquals(response, self.URI_PREFIX + '/jobs/3')262 job = models.Job.objects.get(id=3)263 self.assertEquals(job.name, 'myjob')264 self.assertEquals(job.control_file, self.CONTROL_FILE_CONTENTS)265 self.assertEquals(job.control_type, models.Job.ControlType.SERVER)266 entries = job.hostqueueentry_set.order_by('host__hostname')267 self.assertEquals(entries[0].host.hostname, 'host1')268 self.assertEquals(entries[1].host.hostname, 'host2')269 owner_test = owner270 if not owner_test:271 owner_test = models.User.current_user().login272 self.assertEquals(job.owner, owner_test)273 def test_post_no_owner(self):274 self._test_post_helper(None)275 def test_post_with_owner(self):276 self._test_post_helper('job_owner')277class DirectoryTest(AfeResourceTestCase):278 def test_get(self):279 response = self.request('get', '')280 for key in ('atomic_group_classes', 'labels', 'users', 'acl_groups',281 'hosts', 'tests', 'jobs', 'execution_info',282 'queue_entries_request'):283 self.assert_(key in response)284if __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