mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-02 15:21:25 -07:00
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:
parent
ecfe177380
commit
a685b621cd
4 changed files with 701 additions and 439 deletions
|
@ -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'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue