'Test that we show proper error message if we are trying to create
duplicate permissions.'

def test_duplicated_permissions(self):

    models.Permission._meta.permissions = [(u'change_permission', u'Can    edit    permission    (duplicate)')]
    six.assertRaisesRegex(self, CommandError, u"The    permission    codename    'change_permission'    clashes    with    a    builtin    permission    for    model    'auth.Permission'.", create_permissions, models, [], verbosity=0)
    models.Permission._meta.permissions = [(u'my_custom_permission', u'Some    permission'), (u'other_one', u'Some    other    permission'), (u'my_custom_permission', u'Some    permission    with    duplicate    permission    code')]
    six.assertRaisesRegex(self, CommandError, u"The    permission    codename    'my_custom_permission'    is    duplicated    for    model    'auth.Permission'.", create_permissions, models, [], verbosity=0)
    models.Permission._meta.permissions = [(u'my_custom_permission', u'Some    permission'), (u'other_one', u'Some    other    permission')]
    create_permissions(models, [], verbosity=0)
