\n API " \ No newline at end of file + assert ( + r[0][0] + == "[gitlabhq/gitlab-test] root opened [issue #23](http://example.com/diaspora/issues/23): New API: create/update/delete file\n \n> Create new API for manipulations with repository\nAPI" + ) + assert ( + r[0][1] + == '[gitlabhq/gitlab-test] root\n opened issue #23: New API: create/update/delete fileCreate new API for manipulations with repository
\n
\n API ' + ) diff --git a/tests/test_ops_bot.py b/tests/test_ops_bot.py index 4858ff7..2825fce 100644 --- a/tests/test_ops_bot.py +++ b/tests/test_ops_bot.py @@ -1,11 +1,12 @@ import json -from ops_bot import __version__ -from ops_bot import aws + +from ops_bot import __version__, aws def test_version() -> None: assert __version__ == "0.1.0" + sns_subscribtion_unsubscribe = """{ "Type" : "UnsubscribeConfirmation", "MessageId" : "47138184-6831-46b8-8f7c-afc488602d7d", @@ -44,19 +45,25 @@ sns_notification = """{ "UnsubscribeURL" : "https://sns.us-west-2.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-west-2:123456789012:MyTopic:c9135db0-26c4-47ec-8998-413945fb5a96" }""" + async def test_aws_sns_notification() -> None: r = await aws.parse_sns_event(None, json.loads(sns_notification), None) assert r[0][0] == "My First Message\nHello world!" - assert r[0][1] == "My First Message\nCreate new API for manipulations with repository
\n
Hello world!
" + assert ( + r[0][1] + == "My First Message\nHello world!
" + ) + async def test_aws_sns_subscribe() -> None: r = await aws.parse_sns_event(None, json.loads(sns_subscribtion_confirm), None) print(r) - expected = 'You have chosen to subscribe to the topic arn:aws:sns:us-west-2:123456789012:MyTopic.\nTo confirm the subscription, visit the SubscribeURL included in this message.\n\nhttps://sns.us-west-2.amazonaws.com/?Action=ConfirmSubscription&TopicArn=arn:aws:sns:us-west-2:123456789012:MyTopic&Token=2336412f37...' + expected = "You have chosen to subscribe to the topic arn:aws:sns:us-west-2:123456789012:MyTopic.\nTo confirm the subscription, visit the SubscribeURL included in this message.\n\nhttps://sns.us-west-2.amazonaws.com/?Action=ConfirmSubscription&TopicArn=arn:aws:sns:us-west-2:123456789012:MyTopic&Token=2336412f37..." assert r[0] == (expected, expected) + async def test_aws_sns_unsubscribe() -> None: r = await aws.parse_sns_event(None, json.loads(sns_subscribtion_unsubscribe), None) print(r) - expected = 'You have chosen to deactivate subscription arn:aws:sns:us-west-2:123456789012:MyTopic:2bcfbf39-05c3-41de-beaa-fcfcc21c8f55.\nTo cancel this operation and restore the subscription, visit the SubscribeURL included in this message.\n\nhttps://sns.us-west-2.amazonaws.com/?Action=ConfirmSubscription&TopicArn=arn:aws:sns:us-west-2:123456789012:MyTopic&Token=2336412f37fb6...' + expected = "You have chosen to deactivate subscription arn:aws:sns:us-west-2:123456789012:MyTopic:2bcfbf39-05c3-41de-beaa-fcfcc21c8f55.\nTo cancel this operation and restore the subscription, visit the SubscribeURL included in this message.\n\nhttps://sns.us-west-2.amazonaws.com/?Action=ConfirmSubscription&TopicArn=arn:aws:sns:us-west-2:123456789012:MyTopic&Token=2336412f37fb6..." assert r[0] == (expected, expected)