mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 05:10:22 -07:00
Adds redshift_cross_region_snapshots
module (#35527)
* add redshift_cross_region_snapshots module, unit tests. * fix errors * use ec2_argument_spec as the basis for the argument spec. fixed metadata_version * follow best practices by naming example tasks. * code review changes * fix linting errors * Update version added
This commit is contained in:
parent
a44326bb1a
commit
672acbea68
2 changed files with 249 additions and 0 deletions
|
@ -0,0 +1,48 @@
|
|||
from ansible.modules.cloud.amazon import redshift_cross_region_snapshots as rcrs
|
||||
|
||||
mock_status_enabled = {
|
||||
'SnapshotCopyGrantName': 'snapshot-us-east-1-to-us-west-2',
|
||||
'DestinationRegion': 'us-west-2',
|
||||
'RetentionPeriod': 1,
|
||||
}
|
||||
|
||||
mock_status_disabled = {}
|
||||
|
||||
mock_request_illegal = {
|
||||
'snapshot_copy_grant': 'changed',
|
||||
'destination_region': 'us-west-2',
|
||||
'snapshot_retention_period': 1
|
||||
}
|
||||
|
||||
mock_request_update = {
|
||||
'snapshot_copy_grant': 'snapshot-us-east-1-to-us-west-2',
|
||||
'destination_region': 'us-west-2',
|
||||
'snapshot_retention_period': 3
|
||||
}
|
||||
|
||||
mock_request_no_update = {
|
||||
'snapshot_copy_grant': 'snapshot-us-east-1-to-us-west-2',
|
||||
'destination_region': 'us-west-2',
|
||||
'snapshot_retention_period': 1
|
||||
}
|
||||
|
||||
|
||||
def test_fail_at_unsupported_operations():
|
||||
response = rcrs.requesting_unsupported_modifications(
|
||||
mock_status_enabled, mock_request_illegal
|
||||
)
|
||||
assert response is True
|
||||
|
||||
|
||||
def test_needs_update_true():
|
||||
response = rcrs.needs_update(mock_status_enabled, mock_request_update)
|
||||
assert response is True
|
||||
|
||||
|
||||
def test_no_change():
|
||||
response = rcrs.requesting_unsupported_modifications(
|
||||
mock_status_enabled, mock_request_no_update
|
||||
)
|
||||
needs_update_response = rcrs.needs_update(mock_status_enabled, mock_request_no_update)
|
||||
assert response is False
|
||||
assert needs_update_response is False
|
Loading…
Add table
Add a link
Reference in a new issue