Best Python code snippet using SeleniumBase
github_test.py
Source: github_test.py
...7from detect_secrets_stream.util.conf import ConfUtil8class TestGithub ():9 github_host = ConfUtil.load_github_conf()['host']10 @pytest.fixture11 def test_github(self):12 token_list = ['token1', 'token2', 'token3']13 min_remaining_rate_limit = 314 return GitHub(token_list, min_remaining_rate_limit)15 @pytest.fixture(scope='module')16 def graphql_payload(self):17 return {18 'data': {19 'node': {20 'history': {21 'totalCount': 4,22 'pageInfo': {'endCursor': 1},23 'edges': [24 {'node': {'oid': 2}},25 {'node': {'oid': 1}},...
test_github_crawler.py
Source: test_github_crawler.py
1import pytest2import json3import os4import src.torlib.crawler.github_crawler as gc5from src.torlib.crawler.github_crawler import NoTokenError, LengthNotMatchError, InputNotStringError6import responses7def test_github_crawler_multipage_notoken():8 with pytest.raises(NoTokenError):9 savename = ['1', '1', '1']10 url = ['1', '1', '1']11 gc.github_crawler_multipage(savename, url, [], for_test=True)12def test_github_crawler_multipage_lengthnotmatch():13 with pytest.raises(LengthNotMatchError):14 savename = ['1', '1', '1']15 url = ['1']16 gc.github_crawler_multipage(savename, url, ['token'], for_test=True)17def test_github_crawler_multipage_inputnotstring():18 with pytest.raises(InputNotStringError):19 savename = ['1', '1', '1']20 url = ['1', '1', 1]21 gc.github_crawler_multipage(savename, url, ['token'], for_test=True)22@responses.activate23def test_github_crawler_multipage_fail():24 savename = ['test1', 'test2', 'test3']25 url = ['test_github/api/1', 'test_github/api/2', 'test_github/api/3']26 GHtoken = ['token']27 log_file = 'test_github_crawler_multipage_fail.txt'28 gc.github_crawler_multipage(savename, url, GHtoken, log_file=log_file, for_test=True)29 # check log30 with open(log_file, 'r') as outfile:31 log = json.load(outfile)32 os.remove(log_file)33 assert len(log) == 334@responses.activate35def test_github_crawler_multipage_success():36 savename = ['test1', 'test2', 'test3']37 url = ['http://test_github/api/1',38 'http://test_github/api/2', 'http://test_github/api/3']39 GHtoken = ['token']40 log_file = 'test_github_crawler_multipage_success.txt'41 gc.github_crawler_multipage(savename, url, GHtoken, log_file=log_file, for_test=True)42 # check log43 with open(log_file, 'r') as outfile:44 log = json.load(outfile)45 os.remove(log_file)46 expected_log = []47 assert log == expected_log48 #check result49 for i in range(1,4):50 with open(f'test{i}.json', 'r') as outfile:51 res = json.load(outfile)52 os.remove(f'test{i}.json')53 expected_res = [{"test": f"test{i}"}]...
parser0.py
Source: parser0.py
...3import requests4import sys5from bs4 import BeautifulSoup6from github import Github7def test_github(revstr, revurl):8 print 'test_github({}, {})'.format(revstr, revurl)9 return10def test_sourceforge(revstr, revurl):11 print 'test_sourceforge({}, {})'.format(revstr, revurl)12 return13def test_text(revstr, revurl):14 r = requests.get(revurl)15 revtext = r.text16 if revtext.find(revstr):17 print 'Found {} in {}'.format(revstr, revurl)18 else:19 print 'Did not find {} in {}'.format(revstr, revurl)20 return21try:22 config = {23 'user' : '_www',24 'password': 'PETimage',25 'host' : 'idoimaging.com',26 'database': 'imaging',27 }28 db = mysql.connector.connect(**config)29except mysql.connector.Error as err:30 print(err)31 exit(1)32query = 'select ident, name, revurl, revstr from program'33query = query + ' where ident >= 100'34if len(sys.argv) > 1:35 query = query + " and name like '" + sys.argv[1] + "%'"36query = query + ' and revurl is not null';37query = query + ' and remdate like \'0000%\'';38query = query + ' order by name';39print(query)40curs = db.cursor()41curs.execute(query)42for (ident, name, revurl, revstr) in curs:43 print '{:4d} {:30s} {:25s} {}'.format(ident, name, revstr, revurl)44 if not len(revurl):45 continue46 if revurl.find('http') < 0:47 revurl = 'http://' + revurl48 if revurl.find('github') >= 0:49 test_github(revstr, revurl)50 elif revurl.find('sourceforge') >= 0:51 test_sourceforge(revstr, revurl)52 else:53 test_text(revstr, revurl)54curs.close()...
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!!