Fix AttributeNames for sqs.receive_message (#3736)
* Fix AttributeNames for sqs.receive_message * Fix Lambda issue * Change to parametrized tests * Simplify attribute logic
This commit is contained in:
parent
ac0b4bbcf7
commit
6da4905da9
5 changed files with 383 additions and 24 deletions
|
|
@ -3,6 +3,7 @@ from __future__ import unicode_literals
|
|||
import copy
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
import sure # noqa
|
||||
from freezegun import freeze_time
|
||||
|
||||
|
|
@ -11,24 +12,46 @@ from moto.core.utils import (
|
|||
underscores_to_camelcase,
|
||||
unix_time,
|
||||
py2_strip_unicode_keys,
|
||||
camelcase_to_pascal,
|
||||
pascal_to_camelcase,
|
||||
)
|
||||
|
||||
|
||||
def test_camelcase_to_underscores():
|
||||
cases = {
|
||||
"theNewAttribute": "the_new_attribute",
|
||||
"attri bute With Space": "attribute_with_space",
|
||||
"FirstLetterCapital": "first_letter_capital",
|
||||
"ListMFADevices": "list_mfa_devices",
|
||||
}
|
||||
for arg, expected in cases.items():
|
||||
camelcase_to_underscores(arg).should.equal(expected)
|
||||
@pytest.mark.parametrize(
|
||||
"input,expected",
|
||||
[
|
||||
("theNewAttribute", "the_new_attribute"),
|
||||
("attri bute With Space", "attribute_with_space"),
|
||||
("FirstLetterCapital", "first_letter_capital"),
|
||||
("ListMFADevices", "list_mfa_devices"),
|
||||
],
|
||||
)
|
||||
def test_camelcase_to_underscores(input, expected):
|
||||
camelcase_to_underscores(input).should.equal(expected)
|
||||
|
||||
|
||||
def test_underscores_to_camelcase():
|
||||
cases = {"the_new_attribute": "theNewAttribute"}
|
||||
for arg, expected in cases.items():
|
||||
underscores_to_camelcase(arg).should.equal(expected)
|
||||
@pytest.mark.parametrize(
|
||||
"input,expected",
|
||||
[("the_new_attribute", "theNewAttribute"), ("attribute", "attribute"),],
|
||||
)
|
||||
def test_underscores_to_camelcase(input, expected):
|
||||
underscores_to_camelcase(input).should.equal(expected)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"input,expected",
|
||||
[("TheNewAttribute", "theNewAttribute"), ("Attribute", "attribute"),],
|
||||
)
|
||||
def test_pascal_to_camelcase(input, expected):
|
||||
pascal_to_camelcase(input).should.equal(expected)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"input,expected",
|
||||
[("theNewAttribute", "TheNewAttribute"), ("attribute", "Attribute"),],
|
||||
)
|
||||
def test_camelcase_to_pascal(input, expected):
|
||||
camelcase_to_pascal(input).should.equal(expected)
|
||||
|
||||
|
||||
@freeze_time("2015-01-01 12:00:00")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue