Best Python code snippet using localstack_python
jenkinsjob_manager.py
Source:jenkinsjob_manager.py
...18 def __init__(self, jenkins_info: JenkinsInfo, tenant_data: TenantData, operator: JenkinsOperator):19 self._jenkins_info = jenkins_info20 self._tenant_data = tenant_data21 self._operator = operator22 def disable_job(self, job_name):23 now = datetime.now()24 date_str = now.strftime('%Y-%m-%d')25 time_str = now.strftime('%H:%M')26 description = 'ç¦ç¨å·¥ç¨, zhengfeiteng, {0}, {1}'.format(date_str, time_str)27 self._tenant_data.add_disable_info(self._jenkins_info.url, job_name, description)28 self._operator.disable_job(self._jenkins_info, job_name)29 self._operator.set_job_description(self._jenkins_info, job_name, description)30 31class FakeTenantData:32 def add_disable_info(self, url, job_name, description):33 print('add_disable_info')34 print('url : {0}'.format(url))35 print('job_name : {0}'.format(job_name))36 print('description : {0}'.format(description))37 print('-----')38class FakeJenkinsOperator:39 def disable_job(self, jenkins_info, job_name):40 print('disable_job')41 print('url : {0.url}'.format(jenkins_info))42 print('job_name : {0}'.format(job_name))43 print('-----')44 def set_job_description(self, jenkins_info, job_name, description):45 print('set_job_description')46 print('url : {0.url}'.format(jenkins_info))47 print('job_name : {0}'.format(job_name))48 print('description : {0}'.format(description))49 print('-----')50@click.group()51def cli():52 pass53@cli.command()54def test():55 jenkins_info = JenkinsInfo('http://localhost:8080', username='root', password='1199a58f1a1857c69425979228d20899e1')56 tenant_data = FakeTenantData()57 operator = FakeJenkinsOperator()58 jenkins_manager = JenkinsManager(jenkins_info, tenant_data, operator)59 jenkins_manager.disable_job('simple-compile')60if __name__ == '__main__':...
test_disable.py
Source:test_disable.py
...8 jenkins_mock.side_effect = [9 json.dumps({'name': 'Test Job'}),10 json.dumps({'name': 'Test Job'}),11 ]12 self.j.disable_job(u'Test Job')13 self.assertEqual(14 jenkins_mock.call_args_list[0][0][0].get_full_url(),15 self.make_url('job/Test%20Job/disable'))16 self.assertTrue(self.j.job_exists('Test Job'))17 self._check_requests(jenkins_mock.call_args_list)18 @patch.object(jenkins.Jenkins, 'jenkins_open')19 def test_in_folder(self, jenkins_mock):20 jenkins_mock.side_effect = [21 json.dumps({'name': 'Test Job'}),22 json.dumps({'name': 'Test Job'}),23 ]24 self.j.disable_job(u'a Folder/Test Job')25 self.assertEqual(26 jenkins_mock.call_args_list[0][0][0].get_full_url(),27 self.make_url('job/a%20Folder/job/Test%20Job/disable'))28 self.assertTrue(self.j.job_exists('a Folder/Test Job'))...
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!!