From d6ad27c7a6bb144f7e8366286437d9b3b9b61898 Mon Sep 17 00:00:00 2001 From: Rohit Kapur Date: Fri, 30 Sep 2022 21:35:45 -0400 Subject: [PATCH] fix: fix model for LiquidityPoolRemovedEffect (#43) --- stellar_model/model/horizon/effects.py | 2 +- tests/model/horizon/test_effects.py | 9 ++++++++- .../effects/liquidity_pool_removed.json | 20 +++++++++++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 tests/resources/model/horizon/effects/liquidity_pool_removed.json diff --git a/stellar_model/model/horizon/effects.py b/stellar_model/model/horizon/effects.py index 3ca2f83..1353191 100644 --- a/stellar_model/model/horizon/effects.py +++ b/stellar_model/model/horizon/effects.py @@ -733,7 +733,7 @@ class LiquidityPoolRemovedEffect(BaseEffect): type_i: 94 """ - liquidity_pool: LiquidityPool + liquidity_pool_id: str class LiquidityPoolClaimableAssetAmount(LiquidityPoolAssetAmount): diff --git a/tests/model/horizon/test_effects.py b/tests/model/horizon/test_effects.py index e5b6514..0b22cd1 100644 --- a/tests/model/horizon/test_effects.py +++ b/tests/model/horizon/test_effects.py @@ -1128,7 +1128,14 @@ def test_liquidity_pool_created(self): ) def test_liquidity_pool_removed(self): - pass + raw_data = load_horizon_file("effects/liquidity_pool_removed.json") + parsed_data = LiquidityPoolRemovedEffect.parse_obj(raw_data) + self.assertEqual(parsed_data.id, "0179972298072752130-0000000002") + self.assertEqual(parsed_data.paging_token, "179972298072752130-2") + self.assertEqual( + parsed_data.liquidity_pool_id, + "89c11017d16552c152536092d7440a2cd4cf4bf7df2c7e7552b56e6bcac98d95", + ) def test_liquidity_pool_revoked(self): pass diff --git a/tests/resources/model/horizon/effects/liquidity_pool_removed.json b/tests/resources/model/horizon/effects/liquidity_pool_removed.json new file mode 100644 index 0000000..4455537 --- /dev/null +++ b/tests/resources/model/horizon/effects/liquidity_pool_removed.json @@ -0,0 +1,20 @@ +{ + "_links": { + "operation": { + "href": "https://ubiquity-fullnode-4-mainnet.stellar.bdnodes.net/operations/179972298072752130" + }, + "succeeds": { + "href": "https://ubiquity-fullnode-4-mainnet.stellar.bdnodes.net/effects?order=desc&cursor=179972298072752130-2" + }, + "precedes": { + "href": "https://ubiquity-fullnode-4-mainnet.stellar.bdnodes.net/effects?order=asc&cursor=179972298072752130-2" + } + }, + "id": "0179972298072752130-0000000002", + "paging_token": "179972298072752130-2", + "account": "GBKM2YMDONW2XPZH5PJXVDFKC4U4AXRV4TZXP53YSAJPA6ZWGCJ7YGVZ", + "type": "liquidity_pool_removed", + "type_i": 94, + "created_at": "2022-07-24T12:40:09Z", + "liquidity_pool_id": "89c11017d16552c152536092d7440a2cd4cf4bf7df2c7e7552b56e6bcac98d95" +}