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
2 changes: 1 addition & 1 deletion awsimple/__version__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
__application_name__ = "awsimple"
__title__ = __application_name__
__author__ = "abel"
__version__ = "4.0.0"
__version__ = "4.1.0"
__author_email__ = "j@abel.co"
__url__ = "https://github.com/jamesabel/awsimple"
__download_url__ = "https://github.com/jamesabel/awsimple"
Expand Down
4 changes: 2 additions & 2 deletions awsimple/pubsub.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ def __init__(
:param node_name: Node name (SQS queue name suffix). Defaults to a combination of computer name and username, but can be passed in for customization and/or testing.
:param sub_callback: Optional thread and process safe callback function to be called when a new message is received. The function should accept a single argument, which will be the message as a dictionary.
"""
self.channel = channel
self.node_name = node_name # e.g., computer name
self.channel = channel.lower() # when subscribing SQS queues to SNS topics, the names must all be lowercase (bizarre AWS "gotcha")
self.node_name = node_name.lower() # e.g., computer name or user and computer name
self.sub_callback = sub_callback

self.profile_name = profile_name
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# awsimple requirements
hashy
boto3
typeguard<3
typeguard
dictim
appdirs
tobool
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
keywords=["aws", "cloud", "storage", "database", "dynamodb", "s3"],
packages=[__title__],
package_data={__title__: [readme_file_path, "py.typed"]},
install_requires=["boto3", "typeguard<3", "hashy>=0.1.1", "dictim", "appdirs", "tobool", "urllib3", "python-dateutil", "yasf"],
install_requires=["boto3", "typeguard", "hashy>=0.1.1", "dictim", "appdirs", "tobool", "urllib3", "python-dateutil", "yasf"],
project_urls={"Documentation": "https://awsimple.readthedocs.io/"},
classifiers=[],
python_requires=">3.10",
Expand Down
2 changes: 1 addition & 1 deletion test_awsimple/test_pubsub/test_pubsub_get_messages.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import time

from awsimple import PubSub, is_mock
from awsimple import PubSub


def test_pubsub_get_messages():
Expand Down
29 changes: 29 additions & 0 deletions test_awsimple/test_pubsub/test_pubsub_mixed_case.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import time

from awsimple import PubSub


def test_pubsub_mixed_case():

test_channel = "MyTestChannel" # gets converted to lowercase for SNS topic and SQS queue
node_name = "MyNodeName" # gets converted to lowercase for SNS topic and SQS queue
sent_message = {"MyNumber": 1, "MyBoolean": True, "MyFloat": 2.0 / 3.0}

pubsub = PubSub(test_channel, node_name)
pubsub.start()

pubsub.publish(sent_message)

received_message = None
count = 0
while count < 600:
if len(messages := pubsub.get_messages()) > 0:
received_message = messages[0]
break
time.sleep(0.1)

pubsub.terminate()
pubsub.join(60)
assert not pubsub.is_alive()

assert received_message == sent_message
18 changes: 5 additions & 13 deletions test_awsimple/test_sns_publish.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import json

from awsimple import SNSAccess, SQSPollAccess, is_mock
from awsimple import SNSAccess, SQSPollAccess

from test_awsimple import test_awsimple_str, drain

Expand All @@ -19,13 +17,7 @@ def test_sns_publish():

message_string = "This is a test for awsimple."
subject_string = "awsimple test"
# doesn't work with moto :(
if not is_mock():
message_id = sns_access.publish(message_string, subject_string)
print(f"{message_id=}")
assert message_id is not None and len(message_id) > 0

message = json.loads(sqs_access.receive_message().message)
returned_message_string = message["Message"]
print(f"{returned_message_string=}")
assert returned_message_string == message_string

message_id = sns_access.publish(message_string, subject_string)
print(f"{message_id=}")
assert message_id is not None and len(message_id) > 0