﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
16303	How do I test a database view	benedict.m.holland@…	nobody	"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"	Uncategorized	closed	Testing framework	1.3	Normal	invalid			Unreviewed	0	0	0	0	0	0
