mirror of
https://github.com/planetmint/planetmint.git
synced 2025-06-07 06:36:38 +00:00
fixed the migration to a different output objec (#382)
* fixed the migration to a different output object * fixed test cases (magic mocks) Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
This commit is contained in:
parent
11cf86464f
commit
033235fb16
@ -32,4 +32,4 @@ class OutputListApi(Resource):
|
|||||||
"Invalid output ({}): {} : {} - {}".format(type(e).__name__, e, args["public_key"], args["spent"]),
|
"Invalid output ({}): {} : {} - {}".format(type(e).__name__, e, args["public_key"], args["spent"]),
|
||||||
level="error",
|
level="error",
|
||||||
)
|
)
|
||||||
return [{"transaction_id": output.txid, "output_index": output.output} for output in outputs]
|
return [{"transaction_id": output.transaction_id, "output_index": output.index} for output in outputs]
|
||||||
|
@ -16,8 +16,8 @@ OUTPUTS_ENDPOINT = "/api/v1/outputs/"
|
|||||||
@pytest.mark.userfixtures("inputs")
|
@pytest.mark.userfixtures("inputs")
|
||||||
def test_get_outputs_endpoint(client, user_pk):
|
def test_get_outputs_endpoint(client, user_pk):
|
||||||
m = MagicMock()
|
m = MagicMock()
|
||||||
m.txid = "a"
|
m.transaction_id = "a"
|
||||||
m.output = 0
|
m.index = 0
|
||||||
with patch("planetmint.model.dataaccessor.DataAccessor.get_outputs_filtered") as gof:
|
with patch("planetmint.model.dataaccessor.DataAccessor.get_outputs_filtered") as gof:
|
||||||
gof.return_value = [m, m]
|
gof.return_value = [m, m]
|
||||||
res = client.get(OUTPUTS_ENDPOINT + "?public_key={}".format(user_pk))
|
res = client.get(OUTPUTS_ENDPOINT + "?public_key={}".format(user_pk))
|
||||||
@ -28,8 +28,8 @@ def test_get_outputs_endpoint(client, user_pk):
|
|||||||
|
|
||||||
def test_get_outputs_endpoint_unspent(client, user_pk):
|
def test_get_outputs_endpoint_unspent(client, user_pk):
|
||||||
m = MagicMock()
|
m = MagicMock()
|
||||||
m.txid = "a"
|
m.transaction_id = "a"
|
||||||
m.output = 0
|
m.index = 0
|
||||||
with patch("planetmint.model.dataaccessor.DataAccessor.get_outputs_filtered") as gof:
|
with patch("planetmint.model.dataaccessor.DataAccessor.get_outputs_filtered") as gof:
|
||||||
gof.return_value = [m]
|
gof.return_value = [m]
|
||||||
params = "?spent=False&public_key={}".format(user_pk)
|
params = "?spent=False&public_key={}".format(user_pk)
|
||||||
@ -43,8 +43,8 @@ def test_get_outputs_endpoint_unspent(client, user_pk):
|
|||||||
@pytest.mark.userfixtures("inputs")
|
@pytest.mark.userfixtures("inputs")
|
||||||
def test_get_outputs_endpoint_spent(client, user_pk):
|
def test_get_outputs_endpoint_spent(client, user_pk):
|
||||||
m = MagicMock()
|
m = MagicMock()
|
||||||
m.txid = "a"
|
m.transaction_id = "a"
|
||||||
m.output = 0
|
m.index = 0
|
||||||
with patch("planetmint.model.dataaccessor.DataAccessor.get_outputs_filtered") as gof:
|
with patch("planetmint.model.dataaccessor.DataAccessor.get_outputs_filtered") as gof:
|
||||||
gof.return_value = [m]
|
gof.return_value = [m]
|
||||||
params = "?spent=true&public_key={}".format(user_pk)
|
params = "?spent=true&public_key={}".format(user_pk)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user