Skip to content

Commit 9b84203

Browse files
Merge pull request #54 from JaviCerveraIngram/CPS-8-get-tier-config
Fixing TierConfig.get
2 parents a9031ba + 30a6ff6 commit 9b84203

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

connect/models/tier_config.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,14 @@ class TierConfig(BaseModel):
9696
""" (:py:class:`.BaseModel` | None) Reference to TCR. """
9797

9898
@classmethod
99-
def get(cls, tier_id, product_id, config=None):
99+
def get(cls, account_id, product_id, config=None):
100100
"""
101101
Gets the specified tier config data. For example, to get Tier 1 configuration data
102102
for one request we can do: ::
103103
104104
TierConfig.get(request.asset.tiers.tier1.id, request.asset.product.id)
105105
106-
:param str tier_id: Id of the requested Tier Config.
106+
:param str account_id: Account Id of the requested Tier Config (id with TA prefix).
107107
:param str product_id: Id of the product.
108108
:param Config config: Config to use, or ``None`` to use environment config (default).
109109
:return: The requested Tier Config, or ``None`` if it was not found.
@@ -114,8 +114,8 @@ def get(cls, tier_id, product_id, config=None):
114114
response, _ = ApiClient(config, base_path='tier/config-requests').get(
115115
params={
116116
'status': 'approved',
117-
'configuration.product.id': product_id,
118-
'configuration.account.id': tier_id,
117+
'configuration__product__id': product_id,
118+
'configuration__account__id': account_id,
119119
}
120120
)
121121
objects = TierConfigRequest.deserialize(response)

connect/resources/fulfillment_automation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def get_tier_config(self, tier_id, product_id):
105105
106106
self.get_tier_config(request.asset.tiers.tier1.id, request.asset.product.id)
107107
108-
:param str tier_id: Id of the requested Tier Config.
108+
:param str tier_id: Account Id of the requested Tier Config (id with TA prefix).
109109
:param str product_id: Id of the product.
110110
:return: The requested Tier Config, or ``None`` if it was not found.
111111
:rtype: Optional[TierConfig]

tests/test_models.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def test_asset_methods():
158158
@patch('requests.get')
159159
def test_get_tier_config(get_mock):
160160
get_mock.return_value = _get_response_tier_config_ok()
161-
config = TierConfig.get('tier_id', 'product_id')
161+
config = TierConfig.get('account_id', 'product_id')
162162
assert isinstance(config, TierConfig)
163163
get_mock.assert_called_with(
164164
url='http://localhost:8080/api/public/v1/tier/config-requests/',
@@ -167,8 +167,8 @@ def test_get_tier_config(get_mock):
167167
'Authorization': 'ApiKey XXXX:YYYYY'},
168168
params={
169169
'status': 'approved',
170-
'configuration.product.id': 'product_id',
171-
'configuration.account.id': 'tier_id'})
170+
'configuration__product__id': 'product_id',
171+
'configuration__account__id': 'account_id'})
172172

173173

174174
@patch('requests.get', MagicMock(return_value=Response(ok=True, text='[]', status_code=200)))

0 commit comments

Comments
 (0)