Skip to content

Commit

Permalink
sort dict keys to have more stable diffs, fix test asserting ssl poli…
Browse files Browse the repository at this point in the history
…cy count
  • Loading branch information
dfangl committed Nov 10, 2023
1 parent 92645fd commit 6716157
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
36 changes: 18 additions & 18 deletions moto/elbv2/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

SSL_POLICIES = [
{
"ssl_protocols": ["TLSv1", "TLSv1.1", "TLSv1.2"],
"ciphers": [
{"name": "ECDHE-ECDSA-AES128-GCM-SHA256", "priority": 1},
{"name": "ECDHE-RSA-AES128-GCM-SHA256", "priority": 2},
Expand All @@ -29,9 +28,9 @@
{"name": "AES256-SHA", "priority": 18},
],
"name": "ELBSecurityPolicy-2016-08",
"ssl_protocols": ["TLSv1", "TLSv1.1", "TLSv1.2"],
},
{
"ssl_protocols": ["TLSv1.2", "TLSv1.3"],
"ciphers": [
{"name": "TLS_AES_128_GCM_SHA256", "priority": 1},
{"name": "TLS_AES_256_GCM_SHA384", "priority": 2},
Expand All @@ -46,9 +45,9 @@
{"name": "ECDHE-RSA-AES256-SHA384", "priority": 11},
],
"name": "ELBSecurityPolicy-TLS13-1-2-2021-06",
"ssl_protocols": ["TLSv1.2", "TLSv1.3"],
},
{
"ssl_protocols": ["TLSv1.2", "TLSv1.3"],
"ciphers": [
{"name": "TLS_AES_128_GCM_SHA256", "priority": 1},
{"name": "TLS_AES_256_GCM_SHA384", "priority": 2},
Expand All @@ -59,9 +58,9 @@
{"name": "ECDHE-RSA-AES256-GCM-SHA384", "priority": 7},
],
"name": "ELBSecurityPolicy-TLS13-1-2-Res-2021-06",
"ssl_protocols": ["TLSv1.2", "TLSv1.3"],
},
{
"ssl_protocols": ["TLSv1.2", "TLSv1.3"],
"ciphers": [
{"name": "TLS_AES_128_GCM_SHA256", "priority": 1},
{"name": "TLS_AES_256_GCM_SHA384", "priority": 2},
Expand All @@ -80,9 +79,9 @@
{"name": "AES256-SHA256", "priority": 15},
],
"name": "ELBSecurityPolicy-TLS13-1-2-Ext1-2021-06",
"ssl_protocols": ["TLSv1.2", "TLSv1.3"],
},
{
"ssl_protocols": ["TLSv1.2", "TLSv1.3"],
"ciphers": [
{"name": "TLS_AES_128_GCM_SHA256", "priority": 1},
{"name": "TLS_AES_256_GCM_SHA384", "priority": 2},
Expand All @@ -107,9 +106,9 @@
{"name": "AES256-SHA", "priority": 21},
],
"name": "ELBSecurityPolicy-TLS13-1-2-Ext2-2021-06",
"ssl_protocols": ["TLSv1.2", "TLSv1.3"],
},
{
"ssl_protocols": ["TLSv1.1", "TLSv1.2", "TLSv1.3"],
"ciphers": [
{"name": "TLS_AES_128_GCM_SHA256", "priority": 1},
{"name": "TLS_AES_256_GCM_SHA384", "priority": 2},
Expand All @@ -134,9 +133,9 @@
{"name": "AES256-SHA", "priority": 21},
],
"name": "ELBSecurityPolicy-TLS13-1-1-2021-06",
"ssl_protocols": ["TLSv1.1", "TLSv1.2", "TLSv1.3"],
},
{
"ssl_protocols": ["TLSv1", "TLSv1.1", "TLSv1.2", "TLSv1.3"],
"ciphers": [
{"name": "TLS_AES_128_GCM_SHA256", "priority": 1},
{"name": "TLS_AES_256_GCM_SHA384", "priority": 2},
Expand All @@ -161,18 +160,18 @@
{"name": "AES256-SHA", "priority": 21},
],
"name": "ELBSecurityPolicy-TLS13-1-0-2021-06",
"ssl_protocols": ["TLSv1", "TLSv1.1", "TLSv1.2", "TLSv1.3"],
},
{
"ssl_protocols": ["TLSv1.3"],
"ciphers": [
{"name": "TLS_AES_128_GCM_SHA256", "priority": 1},
{"name": "TLS_AES_256_GCM_SHA384", "priority": 2},
{"name": "TLS_CHACHA20_POLY1305_SHA256", "priority": 3},
],
"name": "ELBSecurityPolicy-TLS13-1-3-2021-06",
"ssl_protocols": ["TLSv1.3"],
},
{
"ssl_protocols": ["TLSv1.2"],
"ciphers": [
{"name": "ECDHE-ECDSA-AES128-GCM-SHA256", "priority": 1},
{"name": "ECDHE-RSA-AES128-GCM-SHA256", "priority": 2},
Expand All @@ -188,9 +187,9 @@
{"name": "AES256-SHA256", "priority": 12},
],
"name": "ELBSecurityPolicy-TLS-1-2-2017-01",
"ssl_protocols": ["TLSv1.2"],
},
{
"ssl_protocols": ["TLSv1.1", "TLSv1.2"],
"ciphers": [
{"name": "ECDHE-ECDSA-AES128-GCM-SHA256", "priority": 1},
{"name": "ECDHE-RSA-AES128-GCM-SHA256", "priority": 2},
Expand All @@ -212,9 +211,9 @@
{"name": "AES256-SHA", "priority": 18},
],
"name": "ELBSecurityPolicy-TLS-1-1-2017-01",
"ssl_protocols": ["TLSv1.1", "TLSv1.2"],
},
{
"ssl_protocols": ["TLSv1.2"],
"ciphers": [
{"name": "ECDHE-ECDSA-AES128-GCM-SHA256", "priority": 1},
{"name": "ECDHE-RSA-AES128-GCM-SHA256", "priority": 2},
Expand All @@ -236,9 +235,9 @@
{"name": "AES256-SHA", "priority": 18},
],
"name": "ELBSecurityPolicy-TLS-1-2-Ext-2018-06",
"ssl_protocols": ["TLSv1.2"],
},
{
"ssl_protocols": ["TLSv1", "TLSv1.1", "TLSv1.2"],
"ciphers": [
{"name": "ECDHE-ECDSA-AES128-GCM-SHA256", "priority": 1},
{"name": "ECDHE-RSA-AES128-GCM-SHA256", "priority": 2},
Expand All @@ -254,9 +253,9 @@
{"name": "ECDHE-ECDSA-AES256-SHA", "priority": 12},
],
"name": "ELBSecurityPolicy-FS-2018-06",
"ssl_protocols": ["TLSv1", "TLSv1.1", "TLSv1.2"],
},
{
"ssl_protocols": ["TLSv1", "TLSv1.1", "TLSv1.2"],
"ciphers": [
{"name": "ECDHE-ECDSA-AES128-GCM-SHA256", "priority": 1},
{"name": "ECDHE-RSA-AES128-GCM-SHA256", "priority": 2},
Expand All @@ -278,9 +277,9 @@
{"name": "AES256-SHA", "priority": 18},
],
"name": "ELBSecurityPolicy-2015-05",
"ssl_protocols": ["TLSv1", "TLSv1.1", "TLSv1.2"],
},
{
"ssl_protocols": ["TLSv1", "TLSv1.1", "TLSv1.2"],
"ciphers": [
{"name": "ECDHE-ECDSA-AES128-GCM-SHA256", "priority": 1},
{"name": "ECDHE-RSA-AES128-GCM-SHA256", "priority": 2},
Expand All @@ -303,9 +302,9 @@
{"name": "DES-CBC3-SHA", "priority": 19},
],
"name": "ELBSecurityPolicy-TLS-1-0-2015-04",
"ssl_protocols": ["TLSv1", "TLSv1.1", "TLSv1.2"],
},
{
"ssl_protocols": ["TLSv1.2"],
"ciphers": [
{"name": "ECDHE-ECDSA-AES128-GCM-SHA256", "priority": 1},
{"name": "ECDHE-RSA-AES128-GCM-SHA256", "priority": 2},
Expand All @@ -317,9 +316,9 @@
{"name": "ECDHE-RSA-AES256-SHA384", "priority": 8},
],
"name": "ELBSecurityPolicy-FS-1-2-Res-2019-08",
"ssl_protocols": ["TLSv1.2"],
},
{
"ssl_protocols": ["TLSv1.1", "TLSv1.2"],
"ciphers": [
{"name": "ECDHE-ECDSA-AES128-GCM-SHA256", "priority": 1},
{"name": "ECDHE-RSA-AES128-GCM-SHA256", "priority": 2},
Expand All @@ -335,9 +334,9 @@
{"name": "ECDHE-ECDSA-AES256-SHA", "priority": 12},
],
"name": "ELBSecurityPolicy-FS-1-1-2019-08",
"ssl_protocols": ["TLSv1.1", "TLSv1.2"],
},
{
"ssl_protocols": ["TLSv1.2"],
"ciphers": [
{"name": "ECDHE-ECDSA-AES128-GCM-SHA256", "priority": 1},
{"name": "ECDHE-RSA-AES128-GCM-SHA256", "priority": 2},
Expand All @@ -353,16 +352,17 @@
{"name": "ECDHE-ECDSA-AES256-SHA", "priority": 12},
],
"name": "ELBSecurityPolicy-FS-1-2-2019-08",
"ssl_protocols": ["TLSv1.2"],
},
{
"ssl_protocols": ["TLSv1.2"],
"ciphers": [
{"name": "ECDHE-ECDSA-AES128-GCM-SHA256", "priority": 1},
{"name": "ECDHE-RSA-AES128-GCM-SHA256", "priority": 2},
{"name": "ECDHE-ECDSA-AES256-GCM-SHA384", "priority": 3},
{"name": "ECDHE-RSA-AES256-GCM-SHA384", "priority": 4},
],
"name": "ELBSecurityPolicy-FS-1-2-Res-2020-10",
"ssl_protocols": ["TLSv1.2"],
},
]

Expand Down
2 changes: 1 addition & 1 deletion scripts/update_ssl_policies.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def transform_policies(ssl_policies: dict):
if not isinstance(ssl_policies, dict):
return ssl_policies
result = {}
for key, value in ssl_policies.items():
for key, value in sorted(ssl_policies.items()):
if key in KEY_BLACKLIST:
continue
new_key = camel_case_to_snake_case(key)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_elbv2/test_elbv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,7 @@ def test_describe_ssl_policies():
client = boto3.client("elbv2", region_name="eu-central-1")

resp = client.describe_ssl_policies()
assert len(resp["SslPolicies"]) == 7
assert len(resp["SslPolicies"]) > 0

resp = client.describe_ssl_policies(
Names=["ELBSecurityPolicy-TLS-1-2-2017-01", "ELBSecurityPolicy-2016-08"]
Expand Down

0 comments on commit 6716157

Please sign in to comment.