Route table boto3 (#32059)

* Allow protection of certain keys during camel_to_snake

Create an `ignore_list` parameter that preserves the case
of the contents of certain dictionaries. Most valuable
for `tags` but other uses might arise.

* Port ec2_vpc_route_table to boto3

Update tests to reflect fixes in boto3.

* Add RETURN documentation to ec2_vpc_route_table

* Update DOCUMENTATION to be valid yaml

* Add check mode tests
This commit is contained in:
Will Thames 2018-01-10 11:09:25 +10:00 committed by Sloane Hertel
parent ecfe177380
commit a685b621cd
4 changed files with 701 additions and 439 deletions

View file

@ -17,7 +17,7 @@
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
from ansible.compat.tests import unittest
from ansible.module_utils.ec2 import _camel_to_snake, _snake_to_camel
from ansible.module_utils.ec2 import _camel_to_snake, _snake_to_camel, camel_dict_to_snake_dict
EXPECTED_SNAKIFICATION = {
'alllower': 'alllower',
@ -61,3 +61,11 @@ class CamelToSnakeAndBackTestCase(unittest.TestCase):
def test_camel_to_snake_and_back(self):
for (k, v) in EXPECTED_REVERSIBLE.items():
self.assertEqual(_snake_to_camel(_camel_to_snake(k, reversible=True), capitalize_first=True), k)
class CamelDictToSnakeDictTestCase(unittest.TestCase):
def test_ignore_list(self):
camel_dict = dict(Hello=dict(One='one', Two='two'), World=dict(Three='three', Four='four'))
snake_dict = camel_dict_to_snake_dict(camel_dict, ignore_list='World')
self.assertEqual(snake_dict['hello'], dict(one='one', two='two'))
self.assertEqual(snake_dict['world'], dict(Three='three', Four='four'))