<div dir="ltr"><div><div><div><div><div><div><div><div><div><div>Hi all,<br><br></div>This is my first post and even though I have been lurking for a while into test driven development, it&#39;s been quite new that I dived into it.<br></div>The problem that caused me a great deal recently is the fact that I am doing some functional tests against a mysql database, build thanks to an sqlalchemy model.<br></div>There are of course numbers of foreign key and my I discovered that the model objects are being created only if there are no foreign key constraints on the database.<br></div>To make it more clear, I tested to run the tests with a setup where all foreign constraints are present (it is actually a dump of the database) and in another setup, the foreign key constraints are deleted, all other things being equal.<br></div>In the first configuration, the test fails and for the latter the test is a success.<br></div>Thus my interrogations : <br></div>- Is this common to delete the foreign key constraints while testing against a database model ? <br></div>- If the test fails while the foreign key constraints are present, does this means the constraints are badly implemented ?<br></div>- How do you tests the foreign key constraints themselves ?<br></div><div>If you have any documentation or open source projects examples that deal with these issues, I would be very glad you&#39;d point them to me ?<br></div><div><br><br></div><div>Thanks in advance,<br><br>Sylvain<br></div><div><br></div>N.B. : I tried a setup where I was letting sqlalchemy build the model itself (i.e. without the dump of the current database, and it fails even sooner during the setup process, before the tests even started)<br></div>