Fix tests after moving PoolManager to shared module

This commit is contained in:
DarkCat09 2024-04-28 14:07:30 +04:00
parent ab93124337
commit c354aeb183
Signed by: DarkCat09
GPG key ID: 0A26CD5B3345D6E3

View file

@ -2,6 +2,7 @@ from unittest import TestCase
import urllib3 import urllib3
import genius import genius
import http_pool
TITLE = 'A Line In The Sand' TITLE = 'A Line In The Sand'
@ -26,17 +27,17 @@ Another day'''
class TestGenius(TestCase): class TestGenius(TestCase):
def setUp(self) -> None: def setUp(self) -> None:
self.http = urllib3.PoolManager() http_pool.get()
def test_search_success(self) -> None: def test_search_success(self) -> None:
url = genius.search(self.http, TITLE, ARTIST) url = genius.search(TITLE, ARTIST)
self.assertEqual(url, URL) self.assertEqual(url, URL)
def test_lyrics_parsing(self) -> None: def test_lyrics_parsing(self) -> None:
lyrics = genius.parse(self.http, URL) lyrics = genius.parse(URL)
self.assertTrue(lyrics.startswith(LYR1)) self.assertTrue(lyrics.startswith(LYR1))
self.assertTrue(LYR2 in lyrics) self.assertTrue(LYR2 in lyrics)
self.assertTrue(LYR3 in lyrics) self.assertTrue(LYR3 in lyrics)
def tearDown(self) -> None: def tearDown(self) -> None:
self.http.clear() http_pool.get().clear()