mirror of
https://github.com/planetmint/planetmint.git
synced 2025-11-25 23:15:44 +00:00
blackified and added an additional test
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
This commit is contained in:
parent
a8ccda78af
commit
985546839d
@ -68,7 +68,7 @@ class TarantoolDBConnection(DBConnection):
|
|||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
try:
|
try:
|
||||||
if self.__conn:
|
if self.__conn:
|
||||||
self.__conn.close()
|
self.__conn.close()
|
||||||
self.__conn = None
|
self.__conn = None
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
@ -84,7 +84,7 @@ class TarantoolDBConnection(DBConnection):
|
|||||||
def exec(self, query, only_data=True):
|
def exec(self, query, only_data=True):
|
||||||
try:
|
try:
|
||||||
conn = self.connect()
|
conn = self.connect()
|
||||||
conn.execute( query ) if only_data else conn.execute(query)
|
conn.execute(query) if only_data else conn.execute(query)
|
||||||
except tarantool.error.OperationalError as op_error:
|
except tarantool.error.OperationalError as op_error:
|
||||||
raise op_error
|
raise op_error
|
||||||
except tarantool.error.NetworkError as net_error:
|
except tarantool.error.NetworkError as net_error:
|
||||||
@ -109,12 +109,12 @@ class TarantoolDBConnection(DBConnection):
|
|||||||
|
|
||||||
def run_command(self, command: str, config: dict):
|
def run_command(self, command: str, config: dict):
|
||||||
from subprocess import run
|
from subprocess import run
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.close()
|
self.close()
|
||||||
except ConnectionError:
|
except ConnectionError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
print(f" commands: {command}")
|
print(f" commands: {command}")
|
||||||
host_port = "%s:%s" % (self.host, self.port)
|
host_port = "%s:%s" % (self.host, self.port)
|
||||||
execute_cmd = self._file_content_to_bytes(path=command)
|
execute_cmd = self._file_content_to_bytes(path=command)
|
||||||
@ -128,12 +128,12 @@ class TarantoolDBConnection(DBConnection):
|
|||||||
|
|
||||||
def run_command_with_output(self, command: str):
|
def run_command_with_output(self, command: str):
|
||||||
from subprocess import run
|
from subprocess import run
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.close()
|
self.close()
|
||||||
except ConnectionError:
|
except ConnectionError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
host_port = "%s:%s" % (
|
host_port = "%s:%s" % (
|
||||||
Config().get()["database"]["host"],
|
Config().get()["database"]["host"],
|
||||||
Config().get()["database"]["port"],
|
Config().get()["database"]["port"],
|
||||||
|
|||||||
@ -11,7 +11,6 @@ from planetmint.transactions.types.assets.create import Create
|
|||||||
from planetmint.transactions.types.assets.transfer import Transfer
|
from planetmint.transactions.types.assets.transfer import Transfer
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
OUTPUTS_ENDPOINT = "/api/v1/outputs/"
|
OUTPUTS_ENDPOINT = "/api/v1/outputs/"
|
||||||
|
|
||||||
|
|
||||||
@ -83,12 +82,40 @@ def test_get_outputs_endpoint_with_invalid_spent(client, user_pk):
|
|||||||
assert res.status_code == 400
|
assert res.status_code == 400
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skip
|
@pytest.mark.skip(
|
||||||
|
reason="just failing sometimes - a test to narrow down the issues of the test 'test_get_divisble_transactions_returns_500'"
|
||||||
|
)
|
||||||
|
@pytest.mark.abci
|
||||||
|
def test_get_divisble_transactions_returns_500_phase_one(b, client):
|
||||||
|
import json
|
||||||
|
import time
|
||||||
|
|
||||||
|
TX_ENDPOINT = "/api/v1/transactions"
|
||||||
|
|
||||||
|
def mine(tx_list):
|
||||||
|
b.store_bulk_transactions(tx_list)
|
||||||
|
|
||||||
|
alice_priv, alice_pub = crypto.generate_key_pair()
|
||||||
|
# bob_priv, bob_pub = crypto.generate_key_pair()
|
||||||
|
# carly_priv, carly_pub = crypto.generate_key_pair()
|
||||||
|
# time.sleep(1)
|
||||||
|
create_tx = Create.generate([alice_pub], [([alice_pub], 4)])
|
||||||
|
create_tx.sign([alice_priv])
|
||||||
|
# ATTENTION: comment out the next line and the test will never fail
|
||||||
|
res = client.post(TX_ENDPOINT, data=json.dumps(create_tx.to_dict()))
|
||||||
|
assert res.status_code == 202
|
||||||
|
|
||||||
|
mine([create_tx])
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skip(
|
||||||
|
reason="this test fails with strange inconsistent tarantool error messages. sometimes, it's even passing."
|
||||||
|
)
|
||||||
@pytest.mark.abci
|
@pytest.mark.abci
|
||||||
def test_get_divisble_transactions_returns_500(b, client):
|
def test_get_divisble_transactions_returns_500(b, client):
|
||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
|
|
||||||
TX_ENDPOINT = "/api/v1/transactions"
|
TX_ENDPOINT = "/api/v1/transactions"
|
||||||
|
|
||||||
def mine(tx_list):
|
def mine(tx_list):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user