diff --git a/planetmint/web/views/outputs.py b/planetmint/web/views/outputs.py index d481b35..23c5487 100644 --- a/planetmint/web/views/outputs.py +++ b/planetmint/web/views/outputs.py @@ -32,4 +32,4 @@ class OutputListApi(Resource): "Invalid output ({}): {} : {} - {}".format(type(e).__name__, e, args["public_key"], args["spent"]), 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] diff --git a/tests/web/test_outputs.py b/tests/web/test_outputs.py index 3a4fc09..ebb758e 100644 --- a/tests/web/test_outputs.py +++ b/tests/web/test_outputs.py @@ -16,8 +16,8 @@ OUTPUTS_ENDPOINT = "/api/v1/outputs/" @pytest.mark.userfixtures("inputs") def test_get_outputs_endpoint(client, user_pk): m = MagicMock() - m.txid = "a" - m.output = 0 + m.transaction_id = "a" + m.index = 0 with patch("planetmint.model.dataaccessor.DataAccessor.get_outputs_filtered") as gof: gof.return_value = [m, m] 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): m = MagicMock() - m.txid = "a" - m.output = 0 + m.transaction_id = "a" + m.index = 0 with patch("planetmint.model.dataaccessor.DataAccessor.get_outputs_filtered") as gof: gof.return_value = [m] 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") def test_get_outputs_endpoint_spent(client, user_pk): m = MagicMock() - m.txid = "a" - m.output = 0 + m.transaction_id = "a" + m.index = 0 with patch("planetmint.model.dataaccessor.DataAccessor.get_outputs_filtered") as gof: gof.return_value = [m] params = "?spent=true&public_key={}".format(user_pk)