Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions connect/models/tier_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,14 @@ class TierConfig(BaseModel):
""" (:py:class:`.BaseModel` | None) Reference to TCR. """

@classmethod
def get(cls, tier_id, product_id, config=None):
def get(cls, account_id, product_id, config=None):
"""
Gets the specified tier config data. For example, to get Tier 1 configuration data
for one request we can do: ::

TierConfig.get(request.asset.tiers.tier1.id, request.asset.product.id)

:param str tier_id: Id of the requested Tier Config.
:param str account_id: Account Id of the requested Tier Config (id with TA prefix).
:param str product_id: Id of the product.
:param Config config: Config to use, or ``None`` to use environment config (default).
:return: The requested Tier Config, or ``None`` if it was not found.
Expand All @@ -114,8 +114,8 @@ def get(cls, tier_id, product_id, config=None):
response, _ = ApiClient(config, base_path='tier/config-requests').get(
params={
'status': 'approved',
'configuration.product.id': product_id,
'configuration.account.id': tier_id,
'configuration__product__id': product_id,
'configuration__account__id': account_id,
}
)
objects = TierConfigRequest.deserialize(response)
Expand Down
2 changes: 1 addition & 1 deletion connect/resources/fulfillment_automation.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def get_tier_config(self, tier_id, product_id):

self.get_tier_config(request.asset.tiers.tier1.id, request.asset.product.id)

:param str tier_id: Id of the requested Tier Config.
:param str tier_id: Account Id of the requested Tier Config (id with TA prefix).
:param str product_id: Id of the product.
:return: The requested Tier Config, or ``None`` if it was not found.
:rtype: Optional[TierConfig]
Expand Down
6 changes: 3 additions & 3 deletions tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def test_asset_methods():
@patch('requests.get')
def test_get_tier_config(get_mock):
get_mock.return_value = _get_response_tier_config_ok()
config = TierConfig.get('tier_id', 'product_id')
config = TierConfig.get('account_id', 'product_id')
assert isinstance(config, TierConfig)
get_mock.assert_called_with(
url='http://localhost:8080/api/public/v1/tier/config-requests/',
Expand All @@ -167,8 +167,8 @@ def test_get_tier_config(get_mock):
'Authorization': 'ApiKey XXXX:YYYYY'},
params={
'status': 'approved',
'configuration.product.id': 'product_id',
'configuration.account.id': 'tier_id'})
'configuration__product__id': 'product_id',
'configuration__account__id': 'account_id'})


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