'Test trimming monthly snapshots and ensure that older months
get deleted properly. The result of this test should be that
the two oldest snapshots get deleted.'

def test_trim_months(self):

    orig = {'get_all_snapshots': self.ec2.get_all_snapshots, 'delete_snapshot': self.ec2.delete_snapshot}
    snaps = self._get_snapshots()
    self.ec2.get_all_snapshots = MagicMock(return_value=snaps)
    self.ec2.delete_snapshot = MagicMock()
    self.ec2.trim_snapshots(monthly_backups=1)
    self.assertEqual(True, self.ec2.get_all_snapshots.called)
    self.assertEqual(2, self.ec2.delete_snapshot.call_count)
    self.ec2.get_all_snapshots = orig['get_all_snapshots']
    self.ec2.delete_snapshot = orig['delete_snapshot']
