Add tests

This commit is contained in:
taizan-hokuto
2020-07-24 14:03:20 +09:00
parent 0abf8dd9f0
commit 174d9f27c0
4 changed files with 76 additions and 17 deletions

View File

@@ -11,13 +11,13 @@ def _open_file(path):
@aioresponses()
def test_Async(*mock):
vid = ''
vid = '__test_id__'
_text = _open_file('tests/testdata/paramgen_firstread.json')
_text = json.loads(_text)
mock[0].get(
f"https://www.youtube.com/live_chat?v={vid}&is_popout=1", status=200, body=_text)
try:
chat = LiveChatAsync(video_id='')
chat = LiveChatAsync(video_id='__test_id__')
assert chat.is_alive()
chat.terminate()
assert not chat.is_alive()
@@ -33,7 +33,7 @@ def test_MultiThread(mocker):
responseMock.text = _text
mocker.patch('requests.Session.get').return_value = responseMock
try:
chat = LiveChatAsync(video_id='')
chat = LiveChatAsync(video_id='__test_id__')
assert chat.is_alive()
chat.terminate()
assert not chat.is_alive()