Skip to content

Commit

Permalink
update unit tests and changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
jatorcasso committed Mar 9, 2022
1 parent abfb49f commit 6dfad9c
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 2 deletions.
2 changes: 1 addition & 1 deletion changelogs/fragments/696-elbv2-support-alb-attributes.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
minor_changes:
- elbv2 - Add support for alb specific attributes (https://github.com/ansible-collections/amazon.aws/pull/696).
- module_utils.elbv2 - Add support for alb specific attributes in module_utils.elbv2 (https://github.com/ansible-collections/amazon.aws/pull/696).
43 changes: 42 additions & 1 deletion tests/unit/module_utils/test_elbv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,27 @@ def setUp(self):
{
"Value": "true",
"Key": "routing.http2.enabled"
}
},
{
"Value": "defensive",
"Key": "routing.http.desync_mitigation_mode"
},
{
"Value": "true",
"Key": "routing.http.drop_invalid_header_fields.enabled"
},
{
"Value": "true",
"Key": "routing.http.x_amzn_tls_version_and_cipher_suite.enabled"
},
{
"Value": "true",
"Key": "routing.http.xff_client_port.enabled"
},
{
"Value": "true",
"Key": "waf.fail_open.enabled"
},
]
}
self.connection.describe_tags.return_value = {
Expand Down Expand Up @@ -165,3 +185,24 @@ def test_modify_ip_address_type_update(self):
self.connection.set_ip_address_type.assert_called_once()
# assert we got the expected value
self.assertEqual(self.elbv2obj.changed, True)

# Test get_elb_attributes
def test_get_elb_attributes(self):
# Build expected result
expected_elb_attributes = {
"access_logs_s3_bucket": "",
"access_logs_s3_enabled": "false",
"access_logs_s3_prefix": "",
"deletion_protection_enabled": "false",
"idle_timeout_timeout_seconds": "60",
"routing_http2_enabled": "true",
"routing_http_desync_mitigation_mode": "defensive",
"routing_http_drop_invalid_header_fields_enabled": "true",
"routing_http_x_amzn_tls_version_and_cipher_suite_enabled": "true",
"routing_http_xff_client_port_enabled": "true",
"waf_fail_open_enabled": "true"
}
# Run module
actual_elb_attributes = self.elbv2obj.get_elb_attributes()
# Assert we got the expected result
self.assertEqual(actual_elb_attributes, expected_elb_attributes)

0 comments on commit 6dfad9c

Please sign in to comment.