Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
hivemind
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
hivemind
Commits
06d539f2
Commit
06d539f2
authored
4 years ago
by
Dariusz Kędzierski
Browse files
Options
Downloads
Patches
Plain Diff
Cleanup
parent
238528e7
Branches
bw_mi/hivemind_wit_sa_btracker_rebase
Branches containing commit
No related tags found
Tags containing commit
4 merge requests
!456
Release candidate v1 24
,
!230
Setup monitoring with pghero
,
!135
Enable postgres monitoring on CI server
,
!84
Upgrade of setup.py
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
setup.py
+7
-5
7 additions, 5 deletions
setup.py
tests/server/test_server_database_api.py
+50
-42
50 additions, 42 deletions
tests/server/test_server_database_api.py
with
57 additions
and
47 deletions
setup.py
+
7
−
5
View file @
06d539f2
...
...
@@ -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
'
,
...
...
This diff is collapsed.
Click to expand it.
tests/server/test_server_database_api.py
+
50
−
42
View file @
06d539f2
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
]
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment