Skip to content
Snippets Groups Projects
Commit 154de1cc authored by Holger Nahrstaedt's avatar Holger Nahrstaedt
Browse files

Code impromements part 3

parent fcda1b96
No related branches found
No related tags found
No related merge requests found
......@@ -8,13 +8,7 @@ matrix:
- os: linux
python: 3.6
env:
- PYFLAKES=1
- PEP8=1
before_install:
- pip install pep8==1.6.2
- pip install flake8
script:
- flake8
- TOXENV=pylint
- os: linux
python: 2.7
env:
......
......@@ -45,10 +45,6 @@ class Block(BlockchainObject):
"""
return parse_time(self['timestamp'])
def change_block_number(self, number):
self.identifier = number
self.refresh()
def ops(self):
ops = []
for tx in self["transactions"]:
......
......@@ -454,7 +454,8 @@ class Steem(object):
# Append to the append_to and return
append_to = kwargs["append_to"]
parent = append_to.get_parent()
assert isinstance(append_to, (TransactionBuilder))
if not isinstance(append_to, (TransactionBuilder)):
raise AssertionError()
append_to.appendOps(ops)
# Add the signer to the buffer so we sign the tx properly
parent.appendSigner(account, permission)
......@@ -677,7 +678,8 @@ class Steem(object):
delegation_fee_steem = Amount(delegation_fee_steem, steem_instance=self)
else:
delegation_fee_steem = Amount(delegation_fee_steem, "STEEM", steem_instance=self)
assert delegation_fee_steem["symbol"] == "STEEM"
if not delegation_fee_steem["symbol"] == "STEEM":
raise AssertionError()
" Generate new keys from password"
from beembase.account import PasswordKey
......
future
pycryptodomex>=3.4.6
ecdsa
requests
websocket-client
pytz
scrypt>=0.8.0
Events>=0.2.2
pyyaml
pytest
pytest-mock
coverage
mock
appdirs
Click
prettytable
......@@ -39,8 +39,6 @@ class Testcases(unittest.TestCase):
block2 = Block(2, steem_instance=bts)
self.assertTrue(block2.time() > block.time())
block2.change_block_number(3)
self.assertEqual(block2.identifier, 3)
def test_block_ops(self):
bts = self.bts
......
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from builtins import super
import unittest
from pprint import pprint
from beem import Steem
from beem.discussions import Query, Discussions_by_trending
from datetime import datetime
from beem.instance import set_shared_steem_instance
wif = "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"
nodes = ["wss://steemd.pevo.science", "wss://gtg.steem.house:8090", "wss://rpc.steemliberator.com", "wss://rpc.buildteam.io",
"wss://rpc.steemviz.com", "wss://seed.bitcoiner.me", "wss://node.steem.ws", "wss://steemd.steemgigs.org", "wss://steemd.steemit.com",
"wss://steemd.minnowsupportproject.org"]
class Testcases(unittest.TestCase):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.bts = Steem(
node=nodes,
nobroadcast=True,
keys={"active": wif},
)
# from getpass import getpass
# self.bts.wallet.unlock(getpass())
set_shared_steem_instance(self.bts)
self.bts.set_default_account("test")
def test_trending(self):
bts = self.bts
query = Query()
query["limit"] = 10
d = Discussions_by_trending(query, steem_instance=bts)
self.assertEqual(len(d), 10)
......@@ -6,6 +6,7 @@ skip_missing_interpreters = true
deps =
mock>=2.0.0
pytest
pytest-mock
coverage
commands =
coverage run --parallel-mode -m pytest {posargs}
......
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