Fuxes up list channel unit tests
This commit is contained in:
parent
9e82282f5e
commit
f90b97d35c
1 changed files with 24 additions and 28 deletions
|
@ -16,6 +16,23 @@ fake.add_provider(internet)
|
|||
fake.add_provider(lorem)
|
||||
fake.add_provider(misc)
|
||||
|
||||
def fake_lbryusername():
|
||||
return '@' + fake.user_name()
|
||||
|
||||
|
||||
def jsonrpc_post(url, method, **params):
|
||||
json_body = {
|
||||
'jsonrpc': '2.0',
|
||||
'id': None,
|
||||
'method': method,
|
||||
'params': params
|
||||
}
|
||||
return requests.post(url=url, json=json_body)
|
||||
|
||||
|
||||
def nothing():
|
||||
return None
|
||||
|
||||
|
||||
class ServerTest(unittest.TestCase):
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
@ -157,23 +174,6 @@ class ServerTest(unittest.TestCase):
|
|||
self.assertIn('error', message)
|
||||
|
||||
|
||||
def fake_lbryusername():
|
||||
return '@' + fake.user_name()
|
||||
|
||||
|
||||
def jsonrpc_post(url, method, **params):
|
||||
json_body = {
|
||||
'jsonrpc': '2.0',
|
||||
'id': None,
|
||||
'method': method,
|
||||
'params': params
|
||||
}
|
||||
return requests.post(url=url, json=json_body)
|
||||
|
||||
|
||||
def nothing():
|
||||
return None
|
||||
|
||||
|
||||
class ListCommentsTest(unittest.TestCase):
|
||||
replace = {
|
||||
|
@ -212,23 +212,19 @@ class ListCommentsTest(unittest.TestCase):
|
|||
self.assertIn('result', response_one)
|
||||
response_one: dict = response_one['result']
|
||||
self.assertIs(type(response_one), dict)
|
||||
self.assertEquals(response_one['page_size'], 20)
|
||||
self.assertEquals(response_one['page_size'], len(response_one['items']))
|
||||
self.assertIn('items', response_one)
|
||||
self.assertEqual(response_one['total_pages'], 2)
|
||||
self.assertGreaterEqual(response_one['total_pages'], response_one['page'])
|
||||
last_page = response_one['total_pages']
|
||||
response = jsonrpc_post(self.url, 'get_claim_comments', page_size=20,
|
||||
page=2, top_level=1, claim_id=self.claim_id).json()
|
||||
page=last_page, top_level=1, claim_id=self.claim_id).json()
|
||||
self.assertIsNotNone(response)
|
||||
self.assertIn('result', response)
|
||||
response: dict = response['result']
|
||||
self.assertIs(response['items'], list)
|
||||
self.assertEquals(len(response['items']), 3)
|
||||
self.assertIs(type(response['items']), list)
|
||||
self.assertEqual(response['total_items'], response_one['total_items'])
|
||||
self.assertEqual(response['total_pages'], 2)
|
||||
result: list = response['items'] + response_one['items']
|
||||
for comment in result:
|
||||
self.assertIsNotNone(comment)
|
||||
self.assertIn('comment_id', comment)
|
||||
self.assertIn(comment['comment_id'], self.comment_ids)
|
||||
self.assertEqual(response['total_pages'], response_one['total_pages'])
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue