Skip to content
Snippets Groups Projects
Commit 06d539f2 authored by Dariusz Kędzierski's avatar Dariusz Kędzierski
Browse files

Cleanup

parent 238528e7
Branches bw_mi/hivemind_wit_sa_btracker_rebase
No related tags found
4 merge requests!456Release candidate v1 24,!230Setup monitoring with pghero,!135Enable postgres monitoring on CI server,!84Upgrade of setup.py
......@@ -63,14 +63,16 @@ setup(
description='Developer-friendly microservice powering social networks on the Steem blockchain.',
long_description=open('README.md').read(),
packages=find_packages(exclude=['scripts']),
setup_requires=['pytest-runner', 'setuptools-git-version', 'tox'],
dependency_links=[
'https://github.com/bcb/jsonrpcserver/tarball/8f3437a19b6d1a8f600ee2c9b112116c85f17827#egg=jsonrpcserver-4.1.3+8f3437a'
setup_requires=[
'importlib_metadata',
'pytest-runner',
'setuptools-git-version',
'tox'
],
install_requires=[
'importlib_metadata',
'aiopg @ https://github.com/aio-libs/aiopg/tarball/862fff97e4ae465333451a4af2a838bfaa3dd0bc',
'jsonrpcserver @ https://github.com/bcb/jsonrpcserver/tarball/8f3437a19b6d1a8f600ee2c9b112116c85f17827#egg=jsonrpcserver',
'aiopg',
'jsonrpcserver',
'simplejson',
'aiohttp',
'certifi',
......
import pytest
from hive.server.database_api.methods import list_comments
from hive.steem.client import SteemClient
from hive.db.adapter import Db
DB = Db.instance()
CTX = {'db' : DB}
@pytest.fixture
def client():
return SteemClient(url='https://api.hive.blog')
return SteemClient(url='https://api.hive.blog')
def test_list_comments_by_cashout_time(client):
reference_data = await client.list_comments({"start":["1970-01-01T00:00:00","steemit","firstpost"],"limit":10,"order":"by_cashout_time"})
test_data = await list_comments(["1970-01-01T00:00:00","steemit","firstpost"],10,"by_cashout_time")
assert reference_data
assert test_data
assert len(reference_data) == len(test_data)
to_compare = ['author','permlink']
for idx in range(len(reference_data)):
for key in to_compare:
assert reference_data[idx][key] == test_data[idx][key]
assert reference_data[idx]['cashout_time'] == test_data[idx]['payout_at']
@pytest.mark.asyncio
async def test_list_comments_by_cashout_time(client):
reference_data = await client.list_comments({"start":["1970-01-01T00:00:00","steemit","firstpost"],"limit":10,"order":"by_cashout_time"})
test_data = await list_comments(CTX, ["1970-01-01T00:00:00","steemit","firstpost"],10,"by_cashout_time")
assert reference_data
assert test_data
assert len(reference_data) == len(test_data)
to_compare = ['author','permlink']
for idx in range(len(reference_data)):
for key in to_compare:
assert reference_data[idx][key] == test_data[idx][key]
assert reference_data[idx]['cashout_time'] == test_data[idx]['payout_at']
def test_list_comments_by_permlink(client):
reference_data = await client.list_comments({"start":["steemit","firstpost"],"limit":10,"order":"by_permlink"})
test_data = await list_comments(["steemit","firstpost"],10,"by_permlink")
assert reference_data
assert test_data
assert len(reference_data) == len(test_data)
to_compare = ['author','permlink']
for idx in range(len(reference_data)):
for key in to_compare:
assert reference_data[idx][key] == test_data[idx][key]
@pytest.mark.asyncio
async def test_list_comments_by_permlink(client):
reference_data = await client.list_comments({"start":["steemit","firstpost"],"limit":10,"order":"by_permlink"})
test_data = await list_comments(CTX, ["steemit","firstpost"],10,"by_permlink")
assert reference_data
assert test_data
assert len(reference_data) == len(test_data)
to_compare = ['author','permlink']
for idx in range(len(reference_data)):
for key in to_compare:
assert reference_data[idx][key] == test_data[idx][key]
def test_list_comments_by_root(client):
reference_data = await client.list_comments({"start":["steemit","firstpost","",""],"limit":10,"order":"by_root"})
test_data = await list_comments(["steemit","firstpost","",""],10,"by_root")
assert reference_data
assert test_data
assert len(reference_data) == len(test_data)
to_compare = ['author','permlink','root_author','root_permlink']
for idx in range(len(reference_data)):
for key in to_compare:
assert reference_data[idx][key] == test_data[idx][key]
@pytest.mark.asyncio
async def test_list_comments_by_root(client):
reference_data = await client.list_comments({"start":["steemit","firstpost","",""],"limit":10,"order":"by_root"})
test_data = await list_comments(CTX, ["steemit","firstpost","",""],10,"by_root")
assert reference_data
assert test_data
assert len(reference_data) == len(test_data)
to_compare = ['author','permlink','root_author','root_permlink']
for idx in range(len(reference_data)):
for key in to_compare:
assert reference_data[idx][key] == test_data[idx][key]
def test_list_comments_by_parent(client):
reference_data = await client.list_comments({"start":["steemit","firstpost","",""],"limit":10,"order":"by_parent"})
test_data = await list_comments(["steemit","firstpost","",""],10,"by_parent")
assert reference_data
assert test_data
assert len(reference_data) == len(test_data)
to_compare = ['author','permlink','parent_author','parent_permlink']
for idx in range(len(reference_data)):
for key in to_compare:
assert reference_data[idx][key] == test_data[idx][key]
@pytest.mark.asyncio
async def test_list_comments_by_parent(client):
reference_data = await client.list_comments({"start":["steemit","firstpost","",""],"limit":10,"order":"by_parent"})
test_data = await list_comments(CTX, ["steemit","firstpost","",""],10,"by_parent")
assert reference_data
assert test_data
assert len(reference_data) == len(test_data)
to_compare = ['author','permlink','parent_author','parent_permlink']
for idx in range(len(reference_data)):
for key in to_compare:
assert reference_data[idx][key] == test_data[idx][key]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment