finalsa-common-models 0.0.3__tar.gz → 0.1.0__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.
Files changed (18) hide show
  1. {finalsa-common-models-0.0.3/finalsa_common_models.egg-info → finalsa_common_models-0.1.0}/PKG-INFO +2 -2
  2. {finalsa-common-models-0.0.3 → finalsa_common_models-0.1.0}/finalsa/common/models/__init__.py +1 -1
  3. {finalsa-common-models-0.0.3 → finalsa_common_models-0.1.0}/finalsa/common/models/models/sqs_response.py +3 -2
  4. {finalsa-common-models-0.0.3 → finalsa_common_models-0.1.0/finalsa_common_models.egg-info}/PKG-INFO +2 -2
  5. {finalsa-common-models-0.0.3 → finalsa_common_models-0.1.0}/setup.py +1 -1
  6. {finalsa-common-models-0.0.3 → finalsa_common_models-0.1.0}/tests/test_client.py +36 -0
  7. {finalsa-common-models-0.0.3 → finalsa_common_models-0.1.0}/LICENSE.md +0 -0
  8. {finalsa-common-models-0.0.3 → finalsa_common_models-0.1.0}/README.md +0 -0
  9. {finalsa-common-models-0.0.3 → finalsa_common_models-0.1.0}/finalsa/common/models/models/__init__.py +0 -0
  10. {finalsa-common-models-0.0.3 → finalsa_common_models-0.1.0}/finalsa/common/models/models/functions.py +0 -0
  11. {finalsa-common-models-0.0.3 → finalsa_common_models-0.1.0}/finalsa/common/models/models/sqs_message.py +0 -0
  12. {finalsa-common-models-0.0.3 → finalsa_common_models-0.1.0}/finalsa/common/models/py.typed +0 -0
  13. {finalsa-common-models-0.0.3 → finalsa_common_models-0.1.0}/finalsa_common_models.egg-info/SOURCES.txt +0 -0
  14. {finalsa-common-models-0.0.3 → finalsa_common_models-0.1.0}/finalsa_common_models.egg-info/dependency_links.txt +0 -0
  15. {finalsa-common-models-0.0.3 → finalsa_common_models-0.1.0}/finalsa_common_models.egg-info/requires.txt +0 -0
  16. {finalsa-common-models-0.0.3 → finalsa_common_models-0.1.0}/finalsa_common_models.egg-info/top_level.txt +0 -0
  17. {finalsa-common-models-0.0.3 → finalsa_common_models-0.1.0}/finalsa_common_models.egg-info/zip-safe +0 -0
  18. {finalsa-common-models-0.0.3 → finalsa_common_models-0.1.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: finalsa-common-models
3
- Version: 0.0.3
3
+ Version: 0.1.0
4
4
  Summary: An utils package for using finalsa common models.
5
5
  Home-page: https://github.com/finalsa/finalsa-common-models
6
6
  Author: Luis Jimenez
@@ -16,7 +16,7 @@ Classifier: Programming Language :: Python :: 3.7
16
16
  Classifier: Programming Language :: Python :: 3.8
17
17
  Classifier: Programming Language :: Python :: 3.9
18
18
  Classifier: Programming Language :: Python :: 3.10
19
- Requires-Python: >=3.8
19
+ Requires-Python: >=3.10
20
20
  Description-Content-Type: text/markdown
21
21
  License-File: LICENSE.md
22
22
  Requires-Dist: boto3>=1.20.3
@@ -5,7 +5,7 @@ from finalsa.common.models.models import (
5
5
  to_message_attributes
6
6
  )
7
7
 
8
- __version__ = "0.0.3"
8
+ __version__ = "0.1.0"
9
9
 
10
10
  __all__ = [
11
11
  "SqsMessage",
@@ -55,8 +55,9 @@ class SqsReponse(BaseModel):
55
55
  return self.get_payload()
56
56
 
57
57
  def parse(self) -> Optional[Dict]:
58
- if self.parse_from_sns() is not None:
59
- return
58
+ sns_response = self.parse_from_sns()
59
+ if sns_response is not None:
60
+ return sns_response
60
61
  return self.get_payload()
61
62
 
62
63
  def get_sqs_message(self) -> SqsMessage:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: finalsa-common-models
3
- Version: 0.0.3
3
+ Version: 0.1.0
4
4
  Summary: An utils package for using finalsa common models.
5
5
  Home-page: https://github.com/finalsa/finalsa-common-models
6
6
  Author: Luis Jimenez
@@ -16,7 +16,7 @@ Classifier: Programming Language :: Python :: 3.7
16
16
  Classifier: Programming Language :: Python :: 3.8
17
17
  Classifier: Programming Language :: Python :: 3.9
18
18
  Classifier: Programming Language :: Python :: 3.10
19
- Requires-Python: >=3.8
19
+ Requires-Python: >=3.10
20
20
  Description-Content-Type: text/markdown
21
21
  License-File: LICENSE.md
22
22
  Requires-Dist: boto3>=1.20.3
@@ -54,7 +54,7 @@ setup(
54
54
  package_data={PACKAGE: ["py.typed"]},
55
55
  include_package_data=True,
56
56
  zip_safe=True,
57
- python_requires=">=3.8",
57
+ python_requires=">=3.10",
58
58
  data_files=[("", ["LICENSE.md"])],
59
59
  install_requires=[
60
60
  "boto3>=1.20.3",
@@ -7,6 +7,7 @@ import uuid
7
7
  import datetime
8
8
  import decimal
9
9
 
10
+ from json import dumps
10
11
  sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../../')))
11
12
 
12
13
 
@@ -139,3 +140,38 @@ def test_to_message_attributes():
139
140
  assert result['datetime']['StringValue'] == attributes['datetime'].isoformat()
140
141
  assert result['decimal']['DataType'] == 'Number'
141
142
  assert result['decimal']['StringValue'] == '1.0'
143
+
144
+
145
+ def test_parse_from_sns_response():
146
+ real_message_body = {
147
+ "test": "test"
148
+ }
149
+ body = dumps({
150
+ 'Type': 'Notification',
151
+ 'TopicArn': 'mytopic',
152
+ 'Message': dumps(real_message_body),
153
+ 'MessageAttributes': {'correlation_id': {
154
+ 'Type': 'String', 'Value': '123e4567-e89b-12d3-a456-426614174000'
155
+ }}
156
+ })
157
+
158
+ boto_response = {
159
+ 'MessageId': 'test',
160
+ 'ReceiptHandle': 'test',
161
+ 'MD5OfBody': 'test',
162
+ 'Body': body,
163
+ 'Attributes': {'test': 'test', 'correlation_id': '123e4567-e89b-12d3-a456-426614174000'},
164
+ 'MessageAttributes': {'correlation_id': {'Type': 'String', 'Value': '123e4567-e89b-12d3-a456-426614174000'}}
165
+
166
+ }
167
+
168
+ response = SqsReponse.from_boto_response(boto_response)
169
+ assert response.body == body
170
+ assert response.get_correlation_id() == '123e4567-e89b-12d3-a456-426614174000'
171
+ assert response.topic == ''
172
+ assert response.message_attributes == {
173
+ 'correlation_id': "123e4567-e89b-12d3-a456-426614174000"}
174
+ assert response.attributes == {
175
+ 'test': 'test', 'correlation_id': '123e4567-e89b-12d3-a456-426614174000'}
176
+ assert response.parse_from_sns() == real_message_body
177
+ assert response.parse() == real_message_body