Best Python code snippet using SeleniumBase
test_auth.py
Source: test_auth.py
...88 user = self.session.query(User).filter_by(username='foo').first()89 self.testapp.post('/auth/ga', status=302, params={90 'submit': 'Authenticate',91 'username': 'foo',92 'code': get_google_auth_code(user.secret)93 })94 self.testapp.get('/')95 def test_submit_success_with_code_check_headers(self):96 from factored.utils import get_google_auth_code97 from factored.models import User98 user = self.session.query(User).filter_by(username='foo').first()99 resp = self.testapp.post('/auth/ga', status=302, params={100 'submit': 'Authenticate',101 'username': 'foo',102 'code': get_google_auth_code(user.secret)103 })104 assert 'pnutbtr=' in resp.headers['Set-Cookie']105class TestEmailAuth(BaseTest):106 def setUp(self):107 super(TestEmailAuth, self).setUp()108 from factored.models import User109 self.user = User(110 username='foo@bar.com', secret=generate_random_google_code())111 self.session.add(self.user)112 self.session.commit()113 def test_email_blank_form(self):114 resp = self.testapp.get('/auth/em', status=200)115 resp.mustcontain('name="username')116 def test_not_send_mail_without_username(self):...
hpool_xch_withdraw.py
Source: hpool_xch_withdraw.py
...97 t2=int(time.time() * 1000)98 res = requests.get(url=f'https://www.hpool.in/api/security/requestsession?_t={t2}', headers=header)99 session = json.loads(res.text).get('data')100 return session101def get_google_auth_code(path):102 '''103 使ç¨`oathtool`çæè°·æéªè¯ç ,èæ¬éè¦ææ§è¡æé,104 èæ¬å
容:`oathtool -b --totp 'key'`.105 éæä½³æ¹æ¡ï¼æ³¨æä¿æ¤å¥½`key`è°¨é²æ³å¯ï¼é æ财产æ失.106 '''107 code = subprocess.getoutput(path)108 # return int(code)109 print(code)110 return code111def xch_withdraw(url, session, code, amount, address, **kwargs):112 '''113 session:请æ±sessionæ¥å£çè¿å,114 code:è°·æéªè¯ç ,115 aomount:å©ä½å
¨é¨xch,116 address:æç°é±å
å°å117 118 æç°å°æå®é±å
å°åpayloadï¼119 '{"session":"","code":"","type":"chia","address":"","amount":""}'120 '''121 type = 'chia'122 payload = {123 "session": f"{session}",124 "code": f"{code}",125 "type": "chia",126 "address": f"{address}",127 "amount": f"{amount}"128 }129 payload = json.dumps(payload)130 # print(payload)131 res = requests.post(url=url, headers=header, data=payload)132 result_code = json.loads(res.text).get('code')133 print(res.text)134 if result_code == 200:135 msg=f'æç°æå,æ¬æ¬¡æç°éé¢ä¸º:{amount}xch,请注ææ¥æ¶.'136 logger.info(f'{msg}')137 send_tg_msg(text=msg)138 return result_code139 else:140 msg='æç°å¤±è´¥,æªç¥é误.'141 logger.error(f"{msg}")142 send_tg_msg(text=msg)143 return None144if __name__ == "__main__":145 # parser = argm(prog='hpool_xch_withdraw',description="hpool xch withdraw helper")146 # parser.add_argument("-K", "--code", dest='code', type=int,help="Google Authenticator Code.")147 # parser.add_argument("-P","--percent", dest='withdraw_percent', default=1,help="Withdraw ratio.")148 # parser.add_argument("-M","--tg",help="Send telegram message.")149 # args = parser.parse_args()150 # code = args.code151 # withdraw_percent = args.withdraw_percent152 # if len(str(code)) == 6:153 # remain_xch=get_total_assets('https://www.hpool.in/api/assets/totalassets')154 # #sign_url=f'https://www.hpool.in/api/assets/totalassets'155 # # print(sign_url)156 # t = int(time.time() * 1000)157 # session=get_token(f'https://www.hpool.in/api/security/requestsession?_t={t}')158 # ## é²æ¢è¢«å«æï¼å¼ºå¶åæ»æç°address.ä¹å¯ä»¥éè¿æ¥å£è·å159 # xch_withdraw(session=session,code=code,amount=remain_xch,address='')160 # else:161 # parser.print_help()162 remain_xch = get_total_assets(163 'https://www.hpool.in/api/assets/totalassets')164 # t = int(time.time() * 1000)165 session = get_token()166 code = get_google_auth_code('/home/chaos/lab/scripts/totp.sh')167 withdraw_url = 'https://www.hpool.in/api/assets/withdraw'168 ## é²æ¢è¢«å«æï¼å¼ºå¶åæ»æç°address.ä¹å¯ä»¥éè¿æ¥å£è·å169 pay_address = ''170 xch_withdraw(url=withdraw_url,171 session=session,172 code=code,173 amount=remain_xch,...
Check out the latest blogs from LambdaTest on this topic:
The QA testing profession requires both educational and long-term or experience-based learning. One can learn the basics from certification courses and exams, boot camp courses, and college-level courses where available. However, developing instinctive and practical skills works best when built with work experience.
Ever since the Internet was invented, web developers have searched for the most efficient ways to display content on web browsers.
In general, software testers have a challenging job. Software testing is frequently the final significant activity undertaken prior to actually delivering a product. Since the terms “software” and “late” are nearly synonymous, it is the testers that frequently catch the ire of the whole business as they try to test the software at the end. It is the testers who are under pressure to finish faster and deem the product “release candidate” before they have had enough opportunity to be comfortable. To make matters worse, if bugs are discovered in the product after it has been released, everyone looks to the testers and says, “Why didn’t you spot those bugs?” The testers did not cause the bugs, but they must bear some of the guilt for the bugs that were disclosed.
Xamarin is an open-source framework that offers cross-platform application development using the C# programming language. It helps to simplify your overall development and management of cross-platform software applications.
When software developers took years to create and introduce new products to the market is long gone. Users (or consumers) today are more eager to use their favorite applications with the latest bells and whistles. However, users today don’t have the patience to work around bugs, errors, and design flaws. People have less self-control, and if your product or application doesn’t make life easier for users, they’ll leave for a better solution.
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!!