How to use test_github method in SeleniumBase

Best Python code snippet using SeleniumBase

github_test.py

Source:github_test.py Github

copy

Full Screen

...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}},...

Full Screen

Full Screen

test_github_crawler.py

Source:test_github_crawler.py Github

copy

Full Screen

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}"}]...

Full Screen

Full Screen

parser0.py

Source:parser0.py Github

copy

Full Screen

...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()...

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 SeleniumBase 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