Skip to content

feat: sns #147

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Oct 26, 2023
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
fetch-depth: 0 # gives the commit message linter access to all previous commits

- name: Commit lint
if: ${{ matrix.python == '3.7' }}
if: ${{ matrix.python == '3.7' && github.ref == 'refs/heads/master' }}
uses: wagoid/commitlint-github-action@v4

- uses: actions/setup-python@v3
Expand Down
10 changes: 10 additions & 0 deletions stream_chat/async_chat/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,16 @@ async def check_sqs(
data = {"sqs_key": sqs_key, "sqs_secret": sqs_secret, "sqs_url": sqs_url}
return await self.post("check_sqs", data=data)

async def check_sns(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[black] reported by reviewdog 🐶

Suggested change
async def check_sns(
async def check_sns(

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [flake8] <301> reported by reviewdog 🐶
expected 1 blank line, found 0

self, sns_key: str = None, sns_secret: str = None, sns_topic_arn: str = None
) -> StreamResponse:
data = {
"sns_key": sns_key,
"sns_secret": sns_secret,
"sns_topic_arn": sns_topic_arn,
}
return await self.post("check_sns", data=data)

async def set_guest_user(self, guest_user: Dict) -> StreamResponse:
return await self.post("guest", data=dict(user=guest_user))

Expand Down
10 changes: 10 additions & 0 deletions stream_chat/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,16 @@ def check_sqs(
data = {"sqs_key": sqs_key, "sqs_secret": sqs_secret, "sqs_url": sqs_url}
return self.post("check_sqs", data=data)

def check_sns(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[black] reported by reviewdog 🐶

Suggested change
def check_sns(
def check_sns(

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [flake8] <301> reported by reviewdog 🐶
expected 1 blank line, found 0

self, sns_key: str = None, sns_secret: str = None, sns_topic_arn: str = None
) -> StreamResponse:
data = {
"sns_key": sns_key,
"sns_secret": sns_secret,
"sns_topic_arn": sns_topic_arn,
}
return self.post("check_sns", data=data)

def get_permission(self, id: str) -> StreamResponse:
return self.get(f"permissions/{id}")

Expand Down
7 changes: 7 additions & 0 deletions stream_chat/tests/async_chat/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,13 @@ async def test_check_sqs(self, client: StreamChatAsync):
assert response["status"] == "error"
assert "invalid SQS url" in response["error"]

async def test_check_sns(self, client: StreamChatAsync):
response = await client.check_sns(
"key", "secret", "arn:aws:sns:us-east-1:123456789012:sns-topic"
)
assert response["status"] == "error"
assert "publishing the message failed." in response["error"]

async def test_guest_user(self, client: StreamChatAsync, random_user: Dict):
try:
response = await client.set_guest_user({"user": {"id": str(uuid.uuid4())}})
Expand Down
7 changes: 7 additions & 0 deletions stream_chat/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,13 @@ def test_check_sqs(self, client: StreamChat):
assert response["status"] == "error"
assert "invalid SQS url" in response["error"]

def test_check_sns(self, client: StreamChat):
response = client.check_sns(
"key", "secret", "arn:aws:sns:us-east-1:123456789012:sns-topic"
)
assert response["status"] == "error"
assert "publishing the message failed." in response["error"]

def test_guest_user(self, client: StreamChat, random_user: Dict):
try:
response = client.set_guest_user({"user": {"id": str(uuid.uuid4())}})
Expand Down