<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Daniel Hepper &#187; testing</title>
	<atom:link href="http://daniel.hepper.net/blog/tag/testing/feed/" rel="self" type="application/rss+xml" />
	<link>http://daniel.hepper.net/blog</link>
	<description>Random geeky stuff</description>
	<lastBuildDate>Wed, 04 Jan 2012 09:12:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Pitfalls in Django unittests</title>
		<link>http://daniel.hepper.net/blog/2008/09/pitfalls-in-django-unittests/</link>
		<comments>http://daniel.hepper.net/blog/2008/09/pitfalls-in-django-unittests/#comments</comments>
		<pubDate>Sat, 13 Sep 2008 13:10:32 +0000</pubDate>
		<dc:creator>Daniel Hepper</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://daniel.hepper.net/blog/?p=9</guid>
		<description><![CDATA[I&#8217;m currently rewriting dwidder and I just spent way to much time on a unit test for the registration view. These are the things that made me stumble: Write fixtures. Unit tests run on an empty database. Somewhere deep in &#8230; <a href="http://daniel.hepper.net/blog/2008/09/pitfalls-in-django-unittests/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m currently rewriting <a title="German SMS-Twitter-Gateway" href="http://dwidder.de">dwidder</a> and I just spent way to much time on a unit test for the registration view. These are the things that made me stumble:</p>
<ol>
<li><strong>Write fixtures</strong>. Unit tests run on an empty database. Somewhere deep in your code might be a reference to one of the default applications, like django.contrib.sites, which will fail, because there is no default site object in your database.</li>
<li><strong>Don&#8217;t subclass unittest.TestCase</strong>. Use Django&#8217;s TestCase class instead. Otherwise you will miss all the fancy stuff, like automatic fixture loading.</li>
<li><strong>Import mail, not outbox.</strong> Django provides a dummy email outbox. But it to make it work as expected, you have to import the mail module. If you import the outbox directly, it will always be empty.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://daniel.hepper.net/blog/2008/09/pitfalls-in-django-unittests/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

