edx-enterprise-subsidy-client 0.3.2__tar.gz → 0.3.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {edx-enterprise-subsidy-client-0.3.2 → edx-enterprise-subsidy-client-0.3.4}/CHANGELOG.rst +9 -0
- {edx-enterprise-subsidy-client-0.3.2 → edx-enterprise-subsidy-client-0.3.4}/PKG-INFO +10 -1
- {edx-enterprise-subsidy-client-0.3.2 → edx-enterprise-subsidy-client-0.3.4}/edx_enterprise_subsidy_client/__init__.py +1 -1
- {edx-enterprise-subsidy-client-0.3.2 → edx-enterprise-subsidy-client-0.3.4}/edx_enterprise_subsidy_client/client.py +15 -5
- {edx-enterprise-subsidy-client-0.3.2 → edx-enterprise-subsidy-client-0.3.4}/edx_enterprise_subsidy_client.egg-info/PKG-INFO +10 -1
- {edx-enterprise-subsidy-client-0.3.2 → edx-enterprise-subsidy-client-0.3.4}/tests/test_client.py +33 -18
- {edx-enterprise-subsidy-client-0.3.2 → edx-enterprise-subsidy-client-0.3.4}/LICENSE +0 -0
- {edx-enterprise-subsidy-client-0.3.2 → edx-enterprise-subsidy-client-0.3.4}/LICENSE.txt +0 -0
- {edx-enterprise-subsidy-client-0.3.2 → edx-enterprise-subsidy-client-0.3.4}/MANIFEST.in +0 -0
- {edx-enterprise-subsidy-client-0.3.2 → edx-enterprise-subsidy-client-0.3.4}/README.rst +0 -0
- {edx-enterprise-subsidy-client-0.3.2 → edx-enterprise-subsidy-client-0.3.4}/edx_enterprise_subsidy_client.egg-info/SOURCES.txt +0 -0
- {edx-enterprise-subsidy-client-0.3.2 → edx-enterprise-subsidy-client-0.3.4}/edx_enterprise_subsidy_client.egg-info/dependency_links.txt +0 -0
- {edx-enterprise-subsidy-client-0.3.2 → edx-enterprise-subsidy-client-0.3.4}/edx_enterprise_subsidy_client.egg-info/not-zip-safe +0 -0
- {edx-enterprise-subsidy-client-0.3.2 → edx-enterprise-subsidy-client-0.3.4}/edx_enterprise_subsidy_client.egg-info/requires.txt +0 -0
- {edx-enterprise-subsidy-client-0.3.2 → edx-enterprise-subsidy-client-0.3.4}/edx_enterprise_subsidy_client.egg-info/top_level.txt +0 -0
- {edx-enterprise-subsidy-client-0.3.2 → edx-enterprise-subsidy-client-0.3.4}/requirements/base.in +0 -0
- {edx-enterprise-subsidy-client-0.3.2 → edx-enterprise-subsidy-client-0.3.4}/requirements/constraints.txt +0 -0
- {edx-enterprise-subsidy-client-0.3.2 → edx-enterprise-subsidy-client-0.3.4}/setup.cfg +0 -0
- {edx-enterprise-subsidy-client-0.3.2 → edx-enterprise-subsidy-client-0.3.4}/setup.py +0 -0
|
@@ -17,6 +17,15 @@ Unreleased
|
|
|
17
17
|
* Switch from ``edx-sphinx-theme`` to ``sphinx-book-theme`` since the former is
|
|
18
18
|
deprecated
|
|
19
19
|
|
|
20
|
+
[0.3.3]
|
|
21
|
+
*******
|
|
22
|
+
* allow additional query params, like ``page_size``, to be passed through to listing endpoints.
|
|
23
|
+
|
|
24
|
+
[0.3.3]
|
|
25
|
+
*******
|
|
26
|
+
* admin-list transactions will also be filtered by ``created`` state by default.
|
|
27
|
+
* Adds an ADR explaining the default states for which this client filters transactions.
|
|
28
|
+
|
|
20
29
|
[0.3.2]
|
|
21
30
|
*******
|
|
22
31
|
* admin-list transactions will ask to be filtered for only `committed` and `pending` states by default.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: edx-enterprise-subsidy-client
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.4
|
|
4
4
|
Summary: Client for interacting with the enterprise-subsidy service.
|
|
5
5
|
Home-page: https://github.com/openedx/edx-enterprise-subsidy-client
|
|
6
6
|
Author: edX
|
|
@@ -227,6 +227,15 @@ Unreleased
|
|
|
227
227
|
* Switch from ``edx-sphinx-theme`` to ``sphinx-book-theme`` since the former is
|
|
228
228
|
deprecated
|
|
229
229
|
|
|
230
|
+
[0.3.3]
|
|
231
|
+
*******
|
|
232
|
+
* allow additional query params, like ``page_size``, to be passed through to listing endpoints.
|
|
233
|
+
|
|
234
|
+
[0.3.3]
|
|
235
|
+
*******
|
|
236
|
+
* admin-list transactions will also be filtered by ``created`` state by default.
|
|
237
|
+
* Adds an ADR explaining the default states for which this client filters transactions.
|
|
238
|
+
|
|
230
239
|
[0.3.2]
|
|
231
240
|
*******
|
|
232
241
|
* admin-list transactions will ask to be filtered for only `committed` and `pending` states by default.
|
|
@@ -74,8 +74,8 @@ class EnterpriseSubsidyAPIClient:
|
|
|
74
74
|
)
|
|
75
75
|
|
|
76
76
|
def get_content_metadata_url(self, content_identifier):
|
|
77
|
-
"""Helper method to generate the subsidy service metadata API url."""
|
|
78
|
-
return self.CONTENT_METADATA_ENDPOINT + content_identifier
|
|
77
|
+
"""Helper method to generate the subsidy service metadata API url, with a trailing slash."""
|
|
78
|
+
return self.CONTENT_METADATA_ENDPOINT + content_identifier + '/'
|
|
79
79
|
|
|
80
80
|
def get_subsidy_content_data(self, enterprise_customer_uuid, content_identifier):
|
|
81
81
|
"""
|
|
@@ -108,7 +108,7 @@ class EnterpriseSubsidyAPIClient:
|
|
|
108
108
|
raise exc
|
|
109
109
|
return response_data.json()
|
|
110
110
|
|
|
111
|
-
def list_subsidies(self, enterprise_customer_uuid):
|
|
111
|
+
def list_subsidies(self, enterprise_customer_uuid, **kwargs):
|
|
112
112
|
"""
|
|
113
113
|
Client method to list enterprise subsidy records for the given enterprise_customer_uuid.
|
|
114
114
|
|
|
@@ -137,9 +137,11 @@ class EnterpriseSubsidyAPIClient:
|
|
|
137
137
|
}
|
|
138
138
|
```
|
|
139
139
|
"""
|
|
140
|
+
query_params = {'enterprise_customer_uuid': enterprise_customer_uuid}
|
|
141
|
+
query_params.update(kwargs)
|
|
140
142
|
response = self.client.get(
|
|
141
143
|
self.SUBSIDIES_ENDPOINT,
|
|
142
|
-
params=
|
|
144
|
+
params=query_params,
|
|
143
145
|
)
|
|
144
146
|
response.raise_for_status()
|
|
145
147
|
return response.json()
|
|
@@ -158,11 +160,13 @@ class EnterpriseSubsidyAPIClient:
|
|
|
158
160
|
self, subsidy_uuid, include_aggregates=True,
|
|
159
161
|
lms_user_id=None, content_key=None,
|
|
160
162
|
subsidy_access_policy_uuid=None,
|
|
163
|
+
**kwargs
|
|
161
164
|
):
|
|
162
165
|
"""
|
|
163
166
|
TODO: add docstring.
|
|
164
167
|
"""
|
|
165
168
|
query_params = {'subsidy_uuid': subsidy_uuid}
|
|
169
|
+
query_params.update(kwargs)
|
|
166
170
|
if include_aggregates:
|
|
167
171
|
query_params['include_aggregates'] = include_aggregates
|
|
168
172
|
if lms_user_id:
|
|
@@ -247,13 +251,19 @@ class EnterpriseSubsidyAPIClientV2(EnterpriseSubsidyAPIClient): # pylint: disab
|
|
|
247
251
|
self, subsidy_uuid, include_aggregates=True,
|
|
248
252
|
lms_user_id=None, content_key=None,
|
|
249
253
|
subsidy_access_policy_uuid=None, transaction_states=None,
|
|
254
|
+
**kwargs,
|
|
250
255
|
):
|
|
251
256
|
"""
|
|
252
257
|
List transactions in a subsidy with admin- or operator-level permissions.
|
|
253
258
|
"""
|
|
254
259
|
query_params = {
|
|
255
|
-
'state': [
|
|
260
|
+
'state': [
|
|
261
|
+
TransactionStateChoices.COMMITTED,
|
|
262
|
+
TransactionStateChoices.PENDING,
|
|
263
|
+
TransactionStateChoices.CREATED,
|
|
264
|
+
],
|
|
256
265
|
}
|
|
266
|
+
query_params.update(kwargs)
|
|
257
267
|
if include_aggregates:
|
|
258
268
|
query_params['include_aggregates'] = include_aggregates
|
|
259
269
|
if lms_user_id:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: edx-enterprise-subsidy-client
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.4
|
|
4
4
|
Summary: Client for interacting with the enterprise-subsidy service.
|
|
5
5
|
Home-page: https://github.com/openedx/edx-enterprise-subsidy-client
|
|
6
6
|
Author: edX
|
|
@@ -227,6 +227,15 @@ Unreleased
|
|
|
227
227
|
* Switch from ``edx-sphinx-theme`` to ``sphinx-book-theme`` since the former is
|
|
228
228
|
deprecated
|
|
229
229
|
|
|
230
|
+
[0.3.3]
|
|
231
|
+
*******
|
|
232
|
+
* allow additional query params, like ``page_size``, to be passed through to listing endpoints.
|
|
233
|
+
|
|
234
|
+
[0.3.3]
|
|
235
|
+
*******
|
|
236
|
+
* admin-list transactions will also be filtered by ``created`` state by default.
|
|
237
|
+
* Adds an ADR explaining the default states for which this client filters transactions.
|
|
238
|
+
|
|
230
239
|
[0.3.2]
|
|
231
240
|
*******
|
|
232
241
|
* admin-list transactions will ask to be filtered for only `committed` and `pending` states by default.
|
{edx-enterprise-subsidy-client-0.3.2 → edx-enterprise-subsidy-client-0.3.4}/tests/test_client.py
RENAMED
|
@@ -62,22 +62,37 @@ def test_v2_list_subsidy_transactions(
|
|
|
62
62
|
|
|
63
63
|
subsidy_service_client = EnterpriseSubsidyAPIClientV2()
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
65
|
+
data_driven_test = [
|
|
66
|
+
(
|
|
67
|
+
{
|
|
68
|
+
'page_size': 1,
|
|
69
|
+
'transaction_states': ['committed', 'pending', 'district-of-columbia'],
|
|
70
|
+
},
|
|
71
|
+
['committed', 'pending'],
|
|
72
|
+
),
|
|
73
|
+
(
|
|
74
|
+
{'page_size': 1},
|
|
75
|
+
['committed', 'pending', 'created'],
|
|
76
|
+
),
|
|
77
|
+
]
|
|
78
|
+
for kwargs, expected_state_call_param in data_driven_test:
|
|
79
|
+
response = subsidy_service_client.list_subsidy_transactions(
|
|
80
|
+
subsidy_uuid=subsidy_uuid,
|
|
81
|
+
lms_user_id=lms_user_id,
|
|
82
|
+
content_key=content_key,
|
|
83
|
+
subsidy_access_policy_uuid=subsidy_access_policy_uuid,
|
|
84
|
+
**kwargs,
|
|
85
|
+
)
|
|
72
86
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
87
|
+
assert response == mocked_response_data
|
|
88
|
+
mock_oauth_client.return_value.get.assert_called_with(
|
|
89
|
+
f'enterprise-subsidy-service-base-url/api/v2/subsidies/{subsidy_uuid}/admin/transactions/',
|
|
90
|
+
params={
|
|
91
|
+
'state': expected_state_call_param,
|
|
92
|
+
'include_aggregates': True,
|
|
93
|
+
'lms_user_id': 123,
|
|
94
|
+
'content_key': 'the-best-content',
|
|
95
|
+
'subsidy_access_policy_uuid': str(subsidy_access_policy_uuid),
|
|
96
|
+
'page_size': 1,
|
|
97
|
+
},
|
|
98
|
+
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{edx-enterprise-subsidy-client-0.3.2 → edx-enterprise-subsidy-client-0.3.4}/requirements/base.in
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|