Skip to content

Commit 9eeddc5

Browse files
committed
ISSUE-84: Test sns Publish parameters
1 parent 42c1f72 commit 9eeddc5

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/ext/botocore/test_botocore.py

+23
Original file line numberDiff line numberDiff line change
@@ -150,3 +150,26 @@ def test_pass_through_on_context_missing():
150150
assert result is not None
151151

152152
xray_recorder.configure(context_missing='RUNTIME_ERROR')
153+
154+
155+
def test_sns_publish_parameters():
156+
sns = session.create_client('sns', region_name='us-west-2')
157+
response = {
158+
'ResponseMetadata': {
159+
'RequestId': REQUEST_ID,
160+
'HTTPStatusCode': 200,
161+
}
162+
}
163+
164+
with Stubber(sns) as stubber:
165+
stubber.add_response('publish', response, {'TopicArn': 'myAmazingTopic', 'Message': 'myBodaciousMessage'})
166+
sns.publish(TopicArn='myAmazingTopic', Message='myBodaciousMessage')
167+
168+
subsegment = xray_recorder.current_segment().subsegments[0]
169+
assert subsegment.http['response']['status'] == 200
170+
171+
aws_meta = subsegment.aws
172+
assert aws_meta['topic_arn'] == 'myAmazingTopic'
173+
assert aws_meta['request_id'] == REQUEST_ID
174+
assert aws_meta['region'] == 'us-west-2'
175+
assert aws_meta['operation'] == 'Publish'

0 commit comments

Comments
 (0)