python-boto3/tests/functional/dynamodb/test_table.py

43 lines
1.4 KiB
Python
Raw Normal View History

2015-11-27 23:25:33 +01:00
# Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
2021-09-22 18:34:33 +02:00
# https://aws.amazon.com/apache2.0/
2015-11-27 23:25:33 +01:00
#
# or in the "license" file accompanying this file. This file is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
from tests import unittest, mock
import boto3
2018-07-11 07:39:36 +02:00
from botocore.stub import Stubber
2015-11-27 23:25:33 +01:00
class TestTableResourceCustomizations(unittest.TestCase):
maxDiff = None
def setUp(self):
self.resource = boto3.resource('dynamodb', 'us-east-1')
def test_resource_has_batch_writer_added(self):
table = self.resource.Table('mytable')
2021-10-04 19:51:32 +02:00
assert hasattr(table, 'batch_writer')
2018-07-11 07:39:36 +02:00
def test_operation_without_output(self):
table = self.resource.Table('mytable')
stubber = Stubber(table.meta.client)
stubber.add_response('tag_resource', {})
arn = 'arn:aws:dynamodb:us-west-2:123456789:table/mytable'
with stubber:
table.meta.client.tag_resource(
ResourceArn=arn,
Tags=[{'Key': 'project', 'Value': 'val'}]
)
stubber.assert_no_pending_responses()