self = <django.db.backends.utils.CursorWrapper object at 0x7f9714a975c0>
sql = 'INSERT INTO "auth_permission" ("name", "content_type_id", "codename") VALUES (%s, %s, %s) RETURNING "auth_permission"."id"'
params = ('moderator', 1, 'moderator')
ignored_wrapper_args = (False, {'connection': <django.db.backends.postgresql.base.DatabaseWrapper object at 0x7f971c9b63c8>, 'cursor': <django.db.backends.utils.CursorWrapper object at 0x7f9714a975c0>})
def _execute(self, sql, params, *ignored_wrapper_args):
self.db.validate_no_broken_transaction()
with self.db.wrap_database_errors:
if params is None:
return self.cursor.execute(sql)
else:
> return self.cursor.execute(sql, params)
E psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint "auth_permission_pkey"
E DETAIL: Key (id)=(1) already exists.
.tox/py3/lib/python3.7/site-packages/django/db/backends/utils.py:84: UniqueViolation
The above exception was the direct cause of the following exception:
@pytest.fixture
def add_forge_moderator():
moderator = User.objects.create_user(username="add-forge moderator", password="")
moderator.user_permissions.add(
> create_django_permission(ADD_FORGE_MODERATOR_PERMISSION)
)
.tox/py3/lib/python3.7/site-packages/swh/web/tests/conftest.py:1224:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/web/tests/utils.py:233: in create_django_permission
codename=perm_name, name=perm_name, content_type=content_type,
.tox/py3/lib/python3.7/site-packages/django/db/models/manager.py:82: in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
.tox/py3/lib/python3.7/site-packages/django/db/models/query.py:422: in create
obj.save(force_insert=True, using=self.db)
.tox/py3/lib/python3.7/site-packages/django/db/models/base.py:744: in save
force_update=force_update, update_fields=update_fields)
.tox/py3/lib/python3.7/site-packages/django/db/models/base.py:782: in save_base
force_update, using, update_fields,
.tox/py3/lib/python3.7/site-packages/django/db/models/base.py:873: in _save_table
result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
.tox/py3/lib/python3.7/site-packages/django/db/models/base.py:911: in _do_insert
using=using, raw=raw)
.tox/py3/lib/python3.7/site-packages/django/db/models/manager.py:82: in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
.tox/py3/lib/python3.7/site-packages/django/db/models/query.py:1186: in _insert
return query.get_compiler(using=using).execute_sql(return_id)
.tox/py3/lib/python3.7/site-packages/django/db/models/sql/compiler.py:1377: in execute_sql
cursor.execute(sql, params)
.tox/py3/lib/python3.7/site-packages/django/db/backends/utils.py:67: in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
.tox/py3/lib/python3.7/site-packages/django/db/backends/utils.py:76: in _execute_with_wrappers
return executor(sql, params, many, context)
.tox/py3/lib/python3.7/site-packages/django/db/backends/utils.py:84: in _execute
return self.cursor.execute(sql, params)
.tox/py3/lib/python3.7/site-packages/django/db/utils.py:89: in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <django.db.backends.utils.CursorWrapper object at 0x7f9714a975c0>
sql = 'INSERT INTO "auth_permission" ("name", "content_type_id", "codename") VALUES (%s, %s, %s) RETURNING "auth_permission"."id"'
params = ('moderator', 1, 'moderator')
ignored_wrapper_args = (False, {'connection': <django.db.backends.postgresql.base.DatabaseWrapper object at 0x7f971c9b63c8>, 'cursor': <django.db.backends.utils.CursorWrapper object at 0x7f9714a975c0>})
def _execute(self, sql, params, *ignored_wrapper_args):
self.db.validate_no_broken_transaction()
with self.db.wrap_database_errors:
if params is None:
return self.cursor.execute(sql)
else:
> return self.cursor.execute(sql, params)
E django.db.utils.IntegrityError: duplicate key value violates unique constraint "auth_permission_pkey"
E DETAIL: Key (id)=(1) already exists.
.tox/py3/lib/python3.7/site-packages/django/db/backends/utils.py:84: IntegrityError
TEST RESULT
TEST RESULT
- Run At
- Mar 17 2022, 10:34 AM