Fix test
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import pytest
|
import pytest
|
||||||
from pytchat.core_multithread.parser import Parser
|
from pytchat.parser.replay import Parser
|
||||||
import pytchat.config as config
|
import pytchat.config as config
|
||||||
import requests, json
|
import requests, json
|
||||||
from pytchat.paramgen import arcparam
|
from pytchat.paramgen import arcparam
|
||||||
@@ -20,7 +20,7 @@ def test_arcparam_2(mocker):
|
|||||||
jsn = json.loads(resp.text)
|
jsn = json.loads(resp.text)
|
||||||
parser = Parser()
|
parser = Parser()
|
||||||
_ , chatdata = parser.parse(jsn)
|
_ , chatdata = parser.parse(jsn)
|
||||||
test_id = chatdata[0]["replayChatItemAction"]["actions"][0]["addChatItemAction"]["item"]["liveChatTextMessageRenderer"]["id"]
|
test_id = chatdata[0]["addChatItemAction"]["item"]["liveChatTextMessageRenderer"]["id"]
|
||||||
print(test_id)
|
print(test_id)
|
||||||
assert "CjoKGkNMYXBzZTdudHVVQ0Zjc0IxZ0FkTnFnQjVREhxDSnlBNHV2bnR1VUNGV0dnd2dvZDd3NE5aZy0w" == test_id
|
assert "CjoKGkNMYXBzZTdudHVVQ0Zjc0IxZ0FkTnFnQjVREhxDSnlBNHV2bnR1VUNGV0dnd2dvZDd3NE5aZy0w" == test_id
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import json
|
import json
|
||||||
import pytest
|
import pytest
|
||||||
import asyncio,aiohttp
|
import asyncio,aiohttp
|
||||||
from pytchat.core_async.parser import Parser
|
from pytchat.parser.live import Parser
|
||||||
from pytchat.processors.compatible.processor import CompatibleProcessor
|
from pytchat.processors.compatible.processor import CompatibleProcessor
|
||||||
from pytchat.exceptions import (
|
from pytchat.exceptions import (
|
||||||
NoLivechatRendererException,NoYtinitialdataException,
|
NoLivechatRendererException,NoYtinitialdataException,
|
||||||
@@ -12,13 +12,15 @@ from pytchat.processors.compatible.renderer.paidmessage import LiveChatPaidMessa
|
|||||||
from pytchat.processors.compatible.renderer.paidsticker import LiveChatPaidStickerRenderer
|
from pytchat.processors.compatible.renderer.paidsticker import LiveChatPaidStickerRenderer
|
||||||
from pytchat.processors.compatible.renderer.legacypaid import LiveChatLegacyPaidMessageRenderer
|
from pytchat.processors.compatible.renderer.legacypaid import LiveChatLegacyPaidMessageRenderer
|
||||||
|
|
||||||
|
parser = Parser()
|
||||||
|
|
||||||
def test_textmessage(mocker):
|
def test_textmessage(mocker):
|
||||||
'''api互換processorのテスト:通常テキストメッセージ'''
|
'''api互換processorのテスト:通常テキストメッセージ'''
|
||||||
processor = CompatibleProcessor()
|
processor = CompatibleProcessor()
|
||||||
|
|
||||||
_json = _open_file("tests/testdata/compatible/textmessage.json")
|
_json = _open_file("tests/testdata/compatible/textmessage.json")
|
||||||
|
|
||||||
_, chatdata = Parser.parse(json.loads(_json))
|
_, chatdata = parser.parse(json.loads(_json))
|
||||||
data = {
|
data = {
|
||||||
"video_id" : "",
|
"video_id" : "",
|
||||||
"timeout" : 7,
|
"timeout" : 7,
|
||||||
@@ -55,7 +57,7 @@ def test_newsponcer(mocker):
|
|||||||
|
|
||||||
_json = _open_file("tests/testdata/compatible/newSponsor.json")
|
_json = _open_file("tests/testdata/compatible/newSponsor.json")
|
||||||
|
|
||||||
_, chatdata = Parser.parse(json.loads(_json))
|
_, chatdata = parser.parse(json.loads(_json))
|
||||||
data = {
|
data = {
|
||||||
"video_id" : "",
|
"video_id" : "",
|
||||||
"timeout" : 7,
|
"timeout" : 7,
|
||||||
@@ -91,7 +93,7 @@ def test_superchat(mocker):
|
|||||||
|
|
||||||
_json = _open_file("tests/testdata/compatible/superchat.json")
|
_json = _open_file("tests/testdata/compatible/superchat.json")
|
||||||
|
|
||||||
_, chatdata = Parser.parse(json.loads(_json))
|
_, chatdata = parser.parse(json.loads(_json))
|
||||||
data = {
|
data = {
|
||||||
"video_id" : "",
|
"video_id" : "",
|
||||||
"timeout" : 7,
|
"timeout" : 7,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import pytest
|
import pytest
|
||||||
from pytchat.core_async.parser import Parser as AsyncParser
|
from pytchat.parser.live import Parser
|
||||||
from pytchat.core_multithread.parser import Parser as ThreadParser
|
|
||||||
import json
|
import json
|
||||||
import asyncio,aiohttp
|
import asyncio,aiohttp
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
import pytest
|
import pytest
|
||||||
from pytchat.core_multithread.parser import Parser
|
|
||||||
import pytchat.config as config
|
|
||||||
import requests, json
|
|
||||||
from pytchat.paramgen import liveparam
|
from pytchat.paramgen import liveparam
|
||||||
|
|
||||||
def test_liveparam_0(mocker):
|
def test_liveparam_0(mocker):
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import pytest
|
import pytest
|
||||||
from pytchat.core_async.parser import Parser
|
from pytchat.parser.live import Parser
|
||||||
import json
|
import json
|
||||||
import asyncio,aiohttp
|
import asyncio,aiohttp
|
||||||
from aioresponses import aioresponses
|
from aioresponses import aioresponses
|
||||||
@@ -11,7 +11,7 @@ from pytchat.exceptions import (
|
|||||||
def _open_file(path):
|
def _open_file(path):
|
||||||
with open(path,mode ='r',encoding = 'utf-8') as f:
|
with open(path,mode ='r',encoding = 'utf-8') as f:
|
||||||
return f.read()
|
return f.read()
|
||||||
|
parser = Parser()
|
||||||
|
|
||||||
@aioresponses()
|
@aioresponses()
|
||||||
def test_finishedlive(*mock):
|
def test_finishedlive(*mock):
|
||||||
@@ -21,7 +21,7 @@ def test_finishedlive(*mock):
|
|||||||
_text = json.loads(_text)
|
_text = json.loads(_text)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
Parser.parse(_text)
|
parser.parse(_text)
|
||||||
assert False
|
assert False
|
||||||
except NoContentsException:
|
except NoContentsException:
|
||||||
assert True
|
assert True
|
||||||
@@ -34,7 +34,7 @@ def test_parsejson(*mock):
|
|||||||
_text = json.loads(_text)
|
_text = json.loads(_text)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
Parser.parse(_text)
|
parser.parse(_text)
|
||||||
jsn = _text
|
jsn = _text
|
||||||
timeout = jsn["response"]["continuationContents"]["liveChatContinuation"]["continuations"][0]["timedContinuationData"]["timeoutMs"]
|
timeout = jsn["response"]["continuationContents"]["liveChatContinuation"]["continuations"][0]["timedContinuationData"]["timeoutMs"]
|
||||||
continuation = jsn["response"]["continuationContents"]["liveChatContinuation"]["continuations"][0]["timedContinuationData"]["continuation"]
|
continuation = jsn["response"]["continuationContents"]["liveChatContinuation"]["continuations"][0]["timedContinuationData"]["continuation"]
|
||||||
|
|||||||
Reference in New Issue
Block a user