'Tests that we handle a duplicate aggregate when migrating and that
we handle when the exception message is in unicode.'

@mock.patch('nova.objects.aggregate.LOG.error')
def test_migrate_aggregates_duplicate_unicode(self, mock_log_error):

    create_aggregate(self.context, 1, in_api=False)
    create_aggregate(self.context, 1, in_api=True)
    with mock.patch.object(exception.AggregateNameExists, 'msg_fmt', u'\xf0\x9f\x92\xa9'):
        (match, done) = aggregate_obj.migrate_aggregates(self.context, 50)
        self.assertEqual(1, match)
        self.assertEqual(0, done)
        mock_log_error.assert_called()
