Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
beem
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
beem
Commits
4ed70821
Commit
4ed70821
authored
6 years ago
by
Holger
Browse files
Options
Downloads
Patches
Plain Diff
Fix unit tests
parent
f829f362
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
tests/beem/test_blockchain.py
+10
-45
10 additions, 45 deletions
tests/beem/test_blockchain.py
tests/beem/test_cli.py
+1
-1
1 addition, 1 deletion
tests/beem/test_cli.py
tests/beem/test_discussions.py
+1
-7
1 addition, 7 deletions
tests/beem/test_discussions.py
with
12 additions
and
53 deletions
tests/beem/test_blockchain.py
+
10
−
45
View file @
4ed70821
...
...
@@ -52,15 +52,8 @@ class Testcases(unittest.TestCase):
cls
.
start_testnet
=
num
-
25
cls
.
stop_testnet
=
num
@parameterized.expand
([
(
"
normal
"
),
(
"
testnet
"
),
])
def
test_blockchain
(
self
,
node_param
):
if
node_param
==
"
normal
"
:
bts
=
self
.
bts
else
:
bts
=
self
.
testnet
def
test_blockchain
(
self
):
bts
=
self
.
bts
b
=
Blockchain
(
steem_instance
=
bts
)
num
=
b
.
get_current_block_num
()
self
.
assertTrue
(
num
>
0
)
...
...
@@ -74,15 +67,8 @@ class Testcases(unittest.TestCase):
timestamp
=
int
(
time
.
mktime
(
block
.
time
().
timetuple
()))
self
.
assertEqual
(
block_timestamp
,
timestamp
)
@parameterized.expand
([
(
"
normal
"
),
(
"
testnet
"
),
])
def
test_estimate_block_num
(
self
,
node_param
):
if
node_param
==
"
normal
"
:
bts
=
self
.
bts
else
:
bts
=
self
.
testnet
def
test_estimate_block_num
(
self
):
bts
=
self
.
bts
b
=
Blockchain
(
steem_instance
=
bts
)
last_block
=
b
.
get_current_block
()
num
=
last_block
.
identifier
...
...
@@ -96,15 +82,8 @@ class Testcases(unittest.TestCase):
self
.
assertTrue
((
est_block_num
-
(
old_block
.
identifier
))
<
2
)
est_block_num
=
b
.
get_estimated_block_num
(
date
,
estimateForwards
=
True
,
accurate
=
False
)
@parameterized.expand
([
(
"
normal
"
),
(
"
testnet
"
),
])
def
test_get_all_accounts
(
self
,
node_param
):
if
node_param
==
"
normal
"
:
bts
=
self
.
bts
else
:
bts
=
self
.
testnet
def
test_get_all_accounts
(
self
):
bts
=
self
.
bts
b
=
Blockchain
(
steem_instance
=
bts
)
accounts
=
[]
limit
=
200
...
...
@@ -226,15 +205,8 @@ class Testcases(unittest.TestCase):
break
self
.
assertTrue
(
len
(
ops_blocks
)
==
1
)
@parameterized.expand
([
(
"
normal
"
),
(
"
testnet
"
),
])
def
test_stream2
(
self
,
node_param
):
if
node_param
==
"
normal
"
:
bts
=
self
.
bts
else
:
bts
=
self
.
testnet
def
test_stream2
(
self
):
bts
=
self
.
bts
b
=
Blockchain
(
steem_instance
=
bts
)
stop_block
=
b
.
get_current_block_num
()
start_block
=
stop_block
-
10
...
...
@@ -243,15 +215,8 @@ class Testcases(unittest.TestCase):
ops_stream
.
append
(
op
)
self
.
assertTrue
(
len
(
ops_stream
)
>
0
)
@parameterized.expand
([
(
"
normal
"
),
(
"
testnet
"
),
])
def
test_wait_for_and_get_block
(
self
,
node_param
):
if
node_param
==
"
normal
"
:
bts
=
self
.
bts
else
:
bts
=
self
.
testnet
def
test_wait_for_and_get_block
(
self
):
bts
=
self
.
bts
b
=
Blockchain
(
steem_instance
=
bts
,
max_block_wait_repetition
=
18
)
start_num
=
b
.
get_current_block_num
()
blocknum
=
start_num
...
...
This diff is collapsed.
Click to expand it.
tests/beem/test_cli.py
+
1
−
1
View file @
4ed70821
...
...
@@ -274,7 +274,7 @@ class Testcases(unittest.TestCase):
runner
.
invoke
(
cli
,
[
'
-o
'
,
'
set
'
,
'
nodes
'
,
str
(
self
.
nodelist
.
get_testnet
())])
result
=
runner
.
invoke
(
cli
,
[
'
-d
'
,
'
newaccount
'
,
'
beem3
'
],
input
=
"
test
\n
test
\n
test
\n
"
)
self
.
assertEqual
(
result
.
exit_code
,
0
)
result
=
runner
.
invoke
(
cli
,
[
'
-d
'
,
'
newaccount
'
,
'
--fee
'
,
'
6 STEEM
'
,
'
beem3
'
],
input
=
"
test
\n
test
\n
test
\n
"
)
result
=
runner
.
invoke
(
cli
,
[
'
-d
'
,
'
newaccount
'
,
'
beem3
'
],
input
=
"
test
\n
test
\n
test
\n
"
)
self
.
assertEqual
(
result
.
exit_code
,
0
)
def
test_importaccount
(
self
):
...
...
This diff is collapsed.
Click to expand it.
tests/beem/test_discussions.py
+
1
−
7
View file @
4ed70821
...
...
@@ -33,12 +33,6 @@ class Testcases(unittest.TestCase):
keys
=
{
"
active
"
:
wif
},
num_retries
=
10
)
cls
.
testnet
=
Steem
(
node
=
"
https://testnet.steemitdev.com
"
,
nobroadcast
=
True
,
keys
=
{
"
active
"
:
wif
},
num_retries
=
10
)
# from getpass import getpass
# self.bts.wallet.unlock(getpass())
set_shared_steem_instance
(
cls
.
bts
)
...
...
@@ -86,7 +80,7 @@ class Testcases(unittest.TestCase):
self
.
assertEqual
(
len
(
d
),
10
)
def
test_cashout
(
self
):
bts
=
self
.
testnet
bts
=
self
.
bts
query
=
Query
(
limit
=
10
)
Discussions_by_cashout
(
query
,
steem_instance
=
bts
)
# self.assertEqual(len(d), 10)
...
...
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