#16303: How do I test a database view
----------------------------------+-----------------------------------
 Reporter:  benedict.m.holland@…  |          Owner:  nobody
     Type:  Uncategorized         |         Status:  new
Milestone:                        |      Component:  Testing framework
  Version:  1.3                   |       Severity:  Normal
 Keywords:                        |   Triage Stage:  Unreviewed
Has patch:  0                     |  Easy pickings:  0
    UI/UX:  0                     |
----------------------------------+-----------------------------------
 I have a database which has views in it. I need to run tests against this,
 so I created unmanaged models. Now I run tests and I get the error:

 DETAIL:  Table X references Y
 HINT:  Truncate table Z at the same time, or use TRUNCATE ... CASCADE.

 which is basically caused by the fact that foreign keys are based off of
 the view. I get this when the TRUNCATE statement is run between tests.
 What worked was when I went into the DB and ran the same statement as a
 TRUNCATE CASCADE, but I can't figure out where this truncate statement is
 run from the django side.

 Another possible fix is the use of essentially #IFDEF statements in c, but
 I don't know if any variable is defined for django when it is running
 tests. I also don't honestly know why the TRUNCATE isn't a CASCADE since
 all of the data is destroyed between tests anyway. Is there a known work
 around for this?

 Thanks so much

-- 
Ticket URL: <https://code.djangoproject.com/ticket/16303>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to