@mock.patch('changes.lib.snapshot_garbage_collection.get_current_datetime')
    def test_expire(self, get_current_datetime):
        project = self.create_project()
        plan = self.create_plan(project)
        self.create_step(plan, data={'cluster': 'cluster'})
        old_snapshot = self.create_snapshot(project)
        old_snapshot_image = self.create_snapshot_image(old_snapshot, plan)
        self.create_cached_snapshot_image(old_snapshot_image)

        snapshot = self.create_snapshot(project)
        snapshot_image = self.create_snapshot_image(snapshot, plan)

        get_current_datetime.return_value = self.mock_datetime

        resp = self.client.post(self.get_endpoint_path(snapshot.id))
        assert resp.status_code == 200
        data = self.unserialize(resp)

        assert len(data) == 1
        assert 'cluster' in data
        assert len(data['cluster']) == 2
        assert snapshot_image.id.hex in data['cluster']

        # The old one hasn't expired quite yet so it should still
        # be in the sync information
        assert old_snapshot_image.id.hex in data['cluster']
Test expiring a cached snapshot by caching a snapshot with the
dataset/ETHPy150Open dropbox/changes/tests/changes/api/test_cached_snapshot_details.py/CachedSnapshotClusterDetailsAPITestCase.test_expire