Skip to content

Commit ba3b8a4

Browse files
committed
Added test for FreeProxy
1 parent 2af460e commit ba3b8a4

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test_module.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,20 @@ def test_tor_launch_own_process(self):
7878
authors = [a for a in scholarly.search_author(query)]
7979
self.assertGreaterEqual(len(authors), 1)
8080

81+
class TestFreeProxy(unittest.TestCase):
82+
luminati = os.getenv("USERNAME") and os.getenv("PASSWORD") and os.getenv("PORT")
83+
scraperAPI = os.getenv('SCRAPER_API_KEY')
84+
skipIf = (luminati is not None) or (scraperAPI is not None)
85+
86+
@unittest.skipIf(skipIf, reason="Other proxy is being used")
87+
def test_freeproxy(self):
88+
"""
89+
Test that we can set up FreeProxy successfully
90+
"""
91+
proxy_generator = ProxyGenerator()
92+
success = proxy_generator.FreeProxies()
93+
self.assertTrue(success)
94+
self.assertEqual(proxy_generator.proxy_mode, "FREE_PROXIES")
8195

8296
class TestScholarly(unittest.TestCase):
8397

0 commit comments

Comments
 (0)