I am struggling with the following issue for a few days now. The application uses django-role-permissions. Unit tests do not work correctly. Here is the example code:
from django.contrib.auth.models import User
from rolepermissions.roles import AbstractUserRole
class FooRole(AbstractUserRole):
available_permissions = {
"foo": "bar"
}
user = User.objects.create(username="abc")
with transaction.atomic():
role = FooRole.assign_role_to_user(user)
When running the test, the following happens when trying to assign role to user:
django.contrib.auth.models.Group.DoesNotExist: Group matching query does not exist.
During handling of the above exception, another exception occurred:
MySQLdb._exceptions.OperationalError: (1305, 'SAVEPOINT s4598857152_x2 does not exist')
Any suggestion would be highly appreciated
EDIT