[pyar] testear django con fixtures me esta volviendo loco
Federico Mendez
mendezfederico87 en gmail.com
Mar Nov 20 17:15:57 ART 2012
Hola muchachos,
Estoy teniendo todos los problemas del mundo para testear un proyecto. El
tema es que como tengo grupos de usuarios me hice unas fixtures de eso con
"./manage.py dumpdata auth.Group > apps/fts/fixtures/initial_data.json".
Cuando hago los tests, corren lo mas bien, pasan... pero me da un error:
IntegrityError: insert or update on table "auth_permission" violates
foreign key constraint "content_type_id_refs_id_728de91f"
DETAIL: Key (content_type_id)=(3) is not present in table
"django_content_type".
Pense,... sera que me falta hacer un dump de esa tabla tambien... asi que
lo hago "./manage.py dumpdata auth.Group contenttypes.Contenttypes >
apps/fts/fixtures/initial_data.json"
Corro los tests y... MUERTE Y DESTRUCCION. Los tests no pasan y ahora me
devuelve esto:
IntegrityError: Could not load contenttypes.ContentType(pk=11):
duplicate key value violates unique constraint
"django_content_type_app_label_model_key"
DETAIL: Key (app_label, model)=(clients, addressmodel) already exists.
Pienso,... yo me estoy volviendo loco... me fijo el dump y no veo nada raro:
{
"pk": 11,
"model": "contenttypes.contenttype",
"fields": {
"model": "addressmodel",
"name": "Address",
"app_label": "clients"
}}, {
"pk": 12,
"model": "contenttypes.contenttype",
"fields": {
"model": "upstreamclientmodel",
"name": "Client",
"app_label": "clients"
}}, {
"pk": 10,
"model": "contenttypes.contenttype",
"fields": {
"model": "phonemodel",
"name": "Phone",
"app_label": "clients"
}}, {
"pk": 4,
"model": "contenttypes.contenttype",
"fields": {
"model": "contenttype",
"name": "content type",
"app_label": "contenttypes"
}}, {
"pk": 2,
"model": "contenttypes.contenttype",
"fields": {
"model": "group",
"name": "group",
"app_label": "auth"
}}, {
"pk": 14,
"model": "contenttypes.contenttype",
"fields": {
"model": "groupobjectpermission",
"name": "group object permission",
"app_label": "guardian"
}}, {
"pk": 7,
"model": "contenttypes.contenttype",
"fields": {
"model": "logentry",
"name": "log entry",
"app_label": "admin"
}}, {
"pk": 8,
"model": "contenttypes.contenttype",
"fields": {
"model": "migrationhistory",
"name": "migration history",
"app_label": "south"
}}, {
"pk": 1,
"model": "contenttypes.contenttype",
"fields": {
"model": "permission",
"name": "permission",
"app_label": "auth"
}}, {
"pk": 5,
"model": "contenttypes.contenttype",
"fields": {
"model": "session",
"name": "session",
"app_label": "sessions"
}}, {
"pk": 6,
"model": "contenttypes.contenttype",
"fields": {
"model": "site",
"name": "site",
"app_label": "sites"
}}, {
"pk": 9,
"model": "contenttypes.contenttype",
"fields": {
"model": "upstreamuserprofile",
"name": "upstream user profile",
"app_label": "accounts"
}}, {
"pk": 15,
"model": "contenttypes.contenttype",
"fields": {
"model": "upstreamuserprofile_client",
"name": "upstreamuserprofile-upstreamclientmodel relationship",
"app_label": "accounts"
}}, {
"pk": 3,
"model": "contenttypes.contenttype",
"fields": {
"model": "user",
"name": "user",
"app_label": "auth"
}}, {
"pk": 13,
"model": "contenttypes.contenttype",
"fields": {
"model": "userobjectpermission",
"name": "user object permission",
"app_label": "guardian"
}}
(por si se ve todo formateado horrible abri un thread en SO con todo esto:
http://stackoverflow.com/questions/13479439/django-content-type-app-label-model-key-integrityerror-while-running-selenium-te
)
Estuve buscando informacion y he visto que hay gente a la que le
recomiendan hacer un dump de toda la base de datos y excluir
contenttypes,... hay gente a la que le recomiendan hacer el dump con
--natural. Yo ya probe todo y sigo teniendo el mismo problema... si a
alguno le paso algo asi, no me vendria mal una mano.
Gracias de antemano!
--
Mit freundlichen Grüßen,
Federico Mendez
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: <http://listas.python.org.ar/pipermail/pyar/attachments/20121120/a9155f83/attachment.html>
More information about the pyar
mailing list