def test_delete_cache_clusters_snapshot(aws_client):
    client = MagicMock()
    aws_client.return_value = client

    client.describe_cache_clusters.return_value = {
        "CacheClusters": [{
            "CacheClusterId":
            "MyTestCacheCluster",
            "CacheClusterStatus":
            "available",
            "CacheNodes": [{
                "CacheNodeId": "0001"
            }, {
                "CacheNodeId": "0002"
            }],
        }]
    }
    client.delete_cache_cluster.return_value = {
        "CacheCluster": {
            "CacheClusterId": "MyTestCacheCluster",
            "CacheClusterStatus": "snapshotting",
            "CacheNodes": [{
                "CacheNodeId": "0001"
            }, {
                "CacheNodeId": "0002"
            }],
        }
    }

    results = delete_cache_clusters(cluster_ids=["MyTestCacheCluster"],
                                    final_snapshot_id="MyClusterFinalSnap")
    client.describe_cache_clusters.assert_called_with(
        CacheClusterId="MyTestCacheCluster", ShowCacheNodeInfo=True)
    client.delete_cache_cluster.assert_called_with(
        CacheClusterId="MyTestCacheCluster",
        FinalSnapshotIdentifier="MyClusterFinalSnap",
    )
    assert results[0]["CacheClusterId"] == "MyTestCacheCluster"
    assert results[0]["CacheClusterStatus"] == "snapshotting"
def test_delete_cache_clusters_snapshot(aws_client):
    client = MagicMock()
    aws_client.return_value = client

    client.describe_cache_clusters.return_value = {
        'CacheClusters': [{
            'CacheClusterId':
            'MyTestCacheCluster',
            'CacheClusterStatus':
            'available',
            'CacheNodes': [{
                'CacheNodeId': '0001'
            }, {
                'CacheNodeId': '0002'
            }]
        }]
    }
    client.delete_cache_cluster.return_value = {
        'CacheCluster': {
            'CacheClusterId': 'MyTestCacheCluster',
            'CacheClusterStatus': 'snapshotting',
            'CacheNodes': [{
                'CacheNodeId': '0001'
            }, {
                'CacheNodeId': '0002'
            }]
        }
    }

    results = delete_cache_clusters(cluster_ids=['MyTestCacheCluster'],
                                    final_snapshot_id='MyClusterFinalSnap')
    client.describe_cache_clusters.assert_called_with(
        CacheClusterId='MyTestCacheCluster', ShowCacheNodeInfo=True)
    client.delete_cache_cluster.assert_called_with(
        CacheClusterId='MyTestCacheCluster',
        FinalSnapshotIdentifier='MyClusterFinalSnap')
    assert results[0]['CacheClusterId'] == 'MyTestCacheCluster'
    assert results[0]['CacheClusterStatus'] == 'snapshotting'
def test_delete_cache_clusters_no_cluster():
    with pytest.raises(TypeError) as x:
        delete_cache_clusters(final_snapshot_id="MyClusterFinalSnapshot")
    assert ("delete_cache_clusters() missing 1 required positional "
            "argument: 'cluster_ids'" in str(x.value))