diff --git a/bigchaindb/web/views/unspents.py b/bigchaindb/web/views/unspents.py index b3a52efe..a934be42 100644 --- a/bigchaindb/web/views/unspents.py +++ b/bigchaindb/web/views/unspents.py @@ -15,14 +15,14 @@ class UnspentListApi(Resource): A :obj:`list` of :cls:`str` of links to unfulfilled conditions. """ parser = reqparse.RequestParser() - parser.add_argument('owner_after', type=str, location='args', + parser.add_argument('public_key', type=str, location='args', required=True) args = parser.parse_args() pool = current_app.config['bigchain_pool'] with pool() as bigchain: - unspents = bigchain.get_owned_ids(args['owner_after']) + unspents = bigchain.get_owned_ids(args['public_key']) # NOTE: We pass '..' as a path to create a valid relative URI return [u.to_uri('..') for u in unspents] diff --git a/tests/web/test_unspents.py b/tests/web/test_unspents.py index 3dc6c487..e5cb3ab1 100644 --- a/tests/web/test_unspents.py +++ b/tests/web/test_unspents.py @@ -7,20 +7,20 @@ UNSPENTS_ENDPOINT = '/api/v1/unspents/' @pytest.mark.usefixtures('inputs') def test_get_unspents_endpoint(b, client, user_pk): expected = [u.to_uri('..') for u in b.get_owned_ids(user_pk)] - res = client.get(UNSPENTS_ENDPOINT + '?owner_after={}'.format(user_pk)) + res = client.get(UNSPENTS_ENDPOINT + '?public_key={}'.format(user_pk)) assert expected == res.json assert res.status_code == 200 @pytest.mark.usefixtures('inputs') -def test_get_unspents_endpoint_without_owner_after(client): +def test_get_unspents_endpoint_without_public_key(client): res = client.get(UNSPENTS_ENDPOINT) assert res.status_code == 400 @pytest.mark.usefixtures('inputs') -def test_get_unspents_endpoint_with_unused_owner_after(client): +def test_get_unspents_endpoint_with_unused_public_key(client): expected = [] - res = client.get(UNSPENTS_ENDPOINT + '?owner_after=abc') + res = client.get(UNSPENTS_ENDPOINT + '?public_key=abc') assert expected == res.json assert res.status_code == 200