How to use __get_param method in autotest

Best Python code snippet using autotest_python

search_params.py

Source:search_params.py Github

copy

Full Screen

...24 self.__advanced = None25 self.__alias = None26 self.__load()27 def __load(self):28 self.domain = self.__get_param('domain', '')29 self.source_ip = self.__get_param('source_ip', '')30 self.cls = self.__get_param('cls', '')31 self.type = self.__get_param('type', '')32 self.matched = self.__get_param('matched', -1, type='int')33 self.forwarded = self.__get_param('forwarded', -1, type='int')34 self.blocked = self.__get_param('blocked', -1, type='int')35 self.date_from = self.__get_param('date_from', '')36 self.date_to = self.__get_param('date_to', '')37 self.time_from = self.__get_param('time_from', '')38 self.time_to = self.__get_param('time_to', '')39 self.page = self.__get_param('page', 1, type='int')40 self.per_page = self.__get_param('per_page', 20, type='int')41 self.user_id = self.__get_param('user_id', -1, type='int')42 self.tags = self.__get_param('tags', [], type='list')43 self.advanced = self.__get_param('advanced', 0, type='int')44 self.alias = self.__get_param('alias', '')45 if len(self.date_from) > 0 and len(self.time_from) == 0:46 self.time_from = '00:00:00'47 elif len(self.time_from) > 0 and len(self.time_from) != 8:48 self.time_from += ':00'49 if len(self.date_to) > 0 and len(self.time_to) == 0:50 self.time_to = '23:59:59'51 elif len(self.time_to) > 0 and len(self.time_to) != 8:52 self.time_to += ':59'53 if self.page <= 0:54 self.page = 155 if isinstance(self.tags, str):56 self.tags = self.tags.split(',')57 self.tags = list(filter(None, self.tags))58 def __get_param(self, name, default, type='str'):59 if self.__request is None:60 return default61 value = default62 if self.__method in ['get', 'post']:63 if self.__method == 'get':64 value = self.__request.args.getlist(name) if type == 'list' else self.__request.args.get(name, value)65 elif self.__method == 'post':66 value = self.__request.form.getlist(name) if type == 'list' else self.__request.form.get(name, value)67 elif self.__method == 'dict':68 value = self.__request[name] if name in self.__request else default69 if type == 'int':70 value = int(value) if str(value).isdigit() else default71 return value72 def url(self):...

Full Screen

Full Screen

jira.py

Source:jira.py Github

copy

Full Screen

...17 self.rest_api_url = settings.JIRA_ENDPOINT18 self.jira = JIRA(basic_auth=(self.rest_api_user, self.rest_api_password),19 options={'server': self.rest_api_url},20 timeout=30)21 def __get_param(self, data: dict, name: str, default_value=None):22 val = data.get(name)23 if val is None:24 val = default_value25 return val26 def create_ticket(self, project: str, data: dict):27 host_name = self.__get_param(data, 'host_name')28 service_name = self.__get_param(data, 'service_name')29 status = self.__get_param(data, 'status')30 service_state = status.name if status is not None else 'FAIL'31 output = self.__get_param(data, 'output', '')32 assignee = self.__get_param(data, 'assignee', [])33 watchers = self.__get_param(data, 'watchers', [])34 tags = self.__get_param(data, 'tags', [])35 priority = self.__get_param(data, 'priority', settings.JIRA_PRIORITY)36 issue_type = self.__get_param(data, 'issue_type', settings.JIRA_ISSUE_TYPE)37 transition_resolved_id = self.__get_param(data, 'transition_resolved_id',38 settings.JIRA_TRANSITION_RESOLVED_ID)39 close_when_restore = self.__get_param(data, 'close_when_restore', settings.JIRA_CLOSE_WHEN_RESTORE)40 post_comments = self.__get_param(data, 'post_comments', settings.JIRA_POST_COMMENTS)41 triggering_status = self.__get_param(data, 'triggering_status', settings.JIRA_TRIGGERING_STATUS)42 try:43 if isinstance(watchers, str):44 watchers_list = re.findall(r'[^,\s]+', watchers)45 elif isinstance(watchers, list):46 watchers_list = watchers47 else:48 watchers_list = []49 if isinstance(tags, str):50 labels = re.findall(r'[^,\s]+', tags)51 elif isinstance(tags, list):52 labels = tags53 else:54 labels = []55 labels.append('nogios')...

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