Modifies tests and entrypoint

This commit is contained in:
Oleg Silkin 2019-05-29 18:01:48 -04:00
parent 15190f032a
commit 6b8414b557
2 changed files with 16 additions and 11 deletions

View file

@ -1,2 +1,4 @@
from src.app import run_app from src.app import run_app
if __name__ == '__main__':
run_app() run_app()

View file

@ -161,7 +161,6 @@ def fake_lbryusername():
return '@' + fake.user_name() return '@' + fake.user_name()
def jsonrpc_post(url, method, **params): def jsonrpc_post(url, method, **params):
json_body = { json_body = {
'jsonrpc': '2.0', 'jsonrpc': '2.0',
@ -211,17 +210,21 @@ class ListCommentsTest(unittest.TestCase):
page=1, top_level=1, claim_id=self.claim_id).json() page=1, top_level=1, claim_id=self.claim_id).json()
self.assertIsNotNone(response_one) self.assertIsNotNone(response_one)
self.assertIn('result', response_one) self.assertIn('result', response_one)
response_one: list = response_one['result'] response_one: dict = response_one['result']
self.assertIs(type(response_one), list) self.assertIs(type(response_one), dict)
self.assertEquals(len(response_one), 20) self.assertEquals(response_one['page_size'], 20)
self.assertIn('items', response_one)
self.assertEqual(response_one['total_pages'], 2)
response = jsonrpc_post(self.url, 'get_claim_comments', page_size=20, response = jsonrpc_post(self.url, 'get_claim_comments', page_size=20,
page=2, top_level=1, claim_id=self.claim_id).json() page=2, top_level=1, claim_id=self.claim_id).json()
self.assertIsNotNone(response) self.assertIsNotNone(response)
self.assertIn('result', response) self.assertIn('result', response)
response: list = response['result'] response: dict = response['result']
self.assertIs(type(response), list) self.assertIs(response['items'], list)
self.assertEquals(len(response), 3) self.assertEquals(len(response['items']), 3)
result = response + response_one 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: for comment in result:
self.assertIsNotNone(comment) self.assertIsNotNone(comment)
self.assertIn('comment_id', comment) self.assertIn('comment_id', comment)