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
543b30c4
Commit
543b30c4
authored
6 years ago
by
roadscape
Browse files
Options
Downloads
Patches
Plain Diff
get_state tests
parent
79002436
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Pipfile
+1
-0
1 addition, 0 deletions
Pipfile
bin/stub_units
+7
-6
7 additions, 6 deletions
bin/stub_units
setup.py
+2
-1
2 additions, 1 deletion
setup.py
tests/test_server_condenser_api.py
+33
-0
33 additions, 0 deletions
tests/test_server_condenser_api.py
with
43 additions
and
7 deletions
Pipfile
+
1
−
0
View file @
543b30c4
...
...
@@ -25,6 +25,7 @@ aiomysql = "*"
"pytest-cov"
=
"*"
"pytest-docker"
=
"*"
"pytest-pylint"
=
"*"
"pytest-asyncio"
=
"*"
"pytest-console-scripts"
=
"*"
"yapf"
=
"*"
"autopep8"
=
"*"
This diff is collapsed.
Click to expand it.
bin/stub_units
+
7
−
6
View file @
543b30c4
...
...
@@ -10,14 +10,15 @@ def _generate(infile):
for
line
in
open
(
infile
,
'
r
'
):
line
=
line
.
strip
()
if
line
[
0
:
4
]
==
'
def
'
and
line
[
0
:
5
]
!=
'
def _
'
:
m
=
re
.
match
(
r
'
^def\s([^\(]+)\(([^\)]*)\):$
'
,
line
)
assert
m
and
m
[
1
],
"
`%s` no match
"
%
line
method
=
m
[
1
]
args
=
m
[
2
]
m
=
re
.
match
(
r
'
^(async )?def\s([^_\(][^\(]+)\(([^\)]*)\):$
'
,
line
)
if
m
:
isasync
=
bool
(
m
[
1
])
method
=
m
[
2
]
args
=
m
[
3
]
methods
.
append
(
method
)
stub
=
"
def test_%s():
\n
assert %s(%s) == expected
"
%
(
method
,
method
,
args
)
stub
=
"
def test_%s():
\n
assert %s%s(%s) == expected
"
%
(
method
,
'
await
'
if
isasync
else
''
,
method
,
args
)
stubs
.
append
(
stub
)
outfile
=
open
(
'
tests/test_
'
+
'
_
'
.
join
(
path
[
1
:])
+
'
.py
'
,
'
w
'
)
...
...
This diff is collapsed.
Click to expand it.
setup.py
+
2
−
1
View file @
543b30c4
...
...
@@ -10,6 +10,7 @@ tests_require = [
'
pytest
'
,
'
pytest-cov
'
,
'
pytest-pylint
'
,
'
pytest-asyncio
'
,
'
pytest-console-scripts
'
,
'
git-pylint-commit-hook
'
,
'
pep8
'
,
...
...
@@ -20,7 +21,7 @@ tests_require = [
setup
(
name
=
'
hivemind
'
,
version
=
'
0.0.1
'
,
description
=
'
Community consensus layer for
the Steem blockchain
'
,
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
'
],
...
...
This diff is collapsed.
Click to expand it.
tests/test_server_condenser_api.py
0 → 100644
+
33
−
0
View file @
543b30c4
import
pytest
from
hive.server.condenser_api.get_state
import
get_state
@pytest.mark.asyncio
async
def
test_get_state
():
ret
=
await
get_state
(
'
/trending
'
)
assert
'
discussion_idx
'
in
ret
assert
await
get_state
(
'
trending
'
)
assert
await
get_state
(
'
promoted
'
)
assert
await
get_state
(
'
created
'
)
assert
await
get_state
(
'
hot
'
)
assert
await
get_state
(
'
@test-safari
'
)
assert
await
get_state
(
'
@test-safari/feed
'
)
assert
await
get_state
(
'
@test-safari/comments
'
)
assert
await
get_state
(
'
@test-safari/recent-replies
'
)
assert
await
get_state
(
'
spam/@test-safari/1ncq2-may-spam
'
)
assert
await
get_state
(
'
trending/blockchain
'
)
assert
await
get_state
(
'
tags
'
)
with
pytest
.
raises
(
AssertionError
):
await
get_state
(
'
trending/blockchain/xxx
'
)
with
pytest
.
raises
(
AssertionError
):
await
get_state
(
'
tags/xxx
'
)
with
pytest
.
raises
(
Exception
):
await
get_state
(
'
witnesses
'
)
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