How to use _set_option method in autotest

Best Python code snippet using autotest_python

options.py

Source:options.py Github

copy

Full Screen

...67 except SysOptionsModel.DoesNotExist:68 mcs._init_option()69 return mcs._get_option(option_key, use_cache=use_cache)70 @classmethod71 def _set_option(mcs, option_key: str, option_value):72 try:73 with transaction.atomic():74 option = SysOptionsModel.objects.select_for_update().get(key=option_key)75 option.value = option_value76 option.save()77 mcs._del_cache(option_key)78 except SysOptionsModel.DoesNotExist:79 mcs._init_option()80 mcs._set_option(option_key, option_value)81 @classmethod82 def _increment(mcs, option_key):83 try:84 with transaction.atomic():85 option = SysOptionsModel.objects.select_for_update().get(key=option_key)86 value = option.value + 187 option.value = value88 option.save()89 mcs._del_cache(option_key)90 except SysOptionsModel.DoesNotExist:91 mcs._init_option()92 return mcs._increment(option_key)93 @classmethod94 def set_options(mcs, options):95 for key, value in options:96 mcs._set_option(key, value)97 @classmethod98 def get_options(mcs, keys):99 result = {}100 for key in keys:101 result[key] = mcs._get_option(key)102 return result103 @property104 def website_base_url(cls):105 return cls._get_option(OptionKeys.website_base_url)106 @website_base_url.setter107 def website_base_url(cls, value):108 cls._set_option(OptionKeys.website_base_url, value)109 @property110 def website_name(cls):111 return cls._get_option(OptionKeys.website_name)112 @website_name.setter113 def website_name(cls, value):114 cls._set_option(OptionKeys.website_name, value)115 @property116 def website_name_shortcut(cls):117 return cls._get_option(OptionKeys.website_name_shortcut)118 @website_name_shortcut.setter119 def website_name_shortcut(cls, value):120 cls._set_option(OptionKeys.website_name_shortcut, value)121 @property122 def website_footer(cls):123 return cls._get_option(OptionKeys.website_footer)124 @website_footer.setter125 def website_footer(cls, value):126 cls._set_option(OptionKeys.website_footer, value)127 @property128 def allow_register(cls):129 return cls._get_option(OptionKeys.allow_register)130 @allow_register.setter131 def allow_register(cls, value):132 cls._set_option(OptionKeys.allow_register, value)133 @property134 def submission_list_show_all(cls):135 return cls._get_option(OptionKeys.submission_list_show_all)136 @submission_list_show_all.setter137 def submission_list_show_all(cls, value):138 cls._set_option(OptionKeys.submission_list_show_all, value)139 @property140 def smtp_config(cls):141 return cls._get_option(OptionKeys.smtp_config)142 @smtp_config.setter143 def smtp_config(cls, value):144 cls._set_option(OptionKeys.smtp_config, value)145 @property146 def judge_server_token(cls):147 return cls._get_option(OptionKeys.judge_server_token)148 @judge_server_token.setter149 def judge_server_token(cls, value):150 cls._set_option(OptionKeys.judge_server_token, value)151 @property152 def throttling(cls):153 return cls._get_option(OptionKeys.throttling)154 @throttling.setter155 def throttling(cls, value):156 cls._set_option(OptionKeys.throttling, value)157class SysOptions(metaclass=_SysOptionsMeta):...

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