Newer
Older
postorius / src / postorius / doc / _build / html / development.html


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Development &mdash; Postorius 1.0a2 documentation</title>
    
    <link rel="stylesheet" href="_static/default.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '',
        VERSION:     '1.0a2',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="top" title="Postorius 1.0a2 documentation" href="index.html" />
    <link rel="prev" title="Installation" href="setup.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="setup.html" title="Installation"
             accesskey="P">previous</a> |</li>
        <li><a href="index.html">Postorius 1.0a2 documentation</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="development">
<h1>Development<a class="headerlink" href="#development" title="Permalink to this headline">¶</a></h1>
<div class="section" id="testing">
<h2>Testing<a class="headerlink" href="#testing" title="Permalink to this headline">¶</a></h2>
<p>All test modules reside in the <tt class="docutils literal"><span class="pre">postorius/src/postorius/tests</span></tt> directory
and this is where you should put your own tests, too. To make the django test
runner find your tests, make sure to add them to the folder&#8217;s <tt class="docutils literal"><span class="pre">__init__.py</span></tt>:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">postorius.tests</span> <span class="kn">import</span> <span class="n">test_utils</span>
<span class="kn">from</span> <span class="nn">postorius.tests.test_list_members</span> <span class="kn">import</span> <span class="n">ListMembersViewTest</span>
<span class="kn">from</span> <span class="nn">postorius.tests.test_list_settings</span> <span class="kn">import</span> <span class="n">ListSettingsViewTest</span>
<span class="kn">from</span> <span class="nn">postorius.tests.my_own_tests</span> <span class="kn">import</span> <span class="n">MyOwnUnitTest</span>

<span class="n">__test__</span> <span class="o">=</span> <span class="p">{</span>
    <span class="s">&quot;Test Utils&quot;</span><span class="p">:</span> <span class="n">test_utils</span><span class="p">,</span>
    <span class="s">&quot;List Members&quot;</span><span class="p">:</span> <span class="n">ListMembersViewTest</span><span class="p">,</span>
    <span class="s">&quot;List Settings&quot;</span><span class="p">:</span> <span class="n">ListSettingsViewTest</span><span class="p">,</span>
    <span class="s">&quot;My Own Test&quot;</span><span class="p">:</span> <span class="n">MyOwnUnitTest</span><span class="p">,</span>
<span class="p">}</span>
</pre></div>
</div>
<div class="section" id="running-the-tests">
<h3>Running the tests<a class="headerlink" href="#running-the-tests" title="Permalink to this headline">¶</a></h3>
<p>To run the tests go to your project folder and run <tt class="docutils literal"><span class="pre">python</span> <span class="pre">manage.py</span> <span class="pre">test</span> <span class="pre">postorius</span></tt> from there.</p>
</div>
<div class="section" id="mocking">
<h3>Mocking<a class="headerlink" href="#mocking" title="Permalink to this headline">¶</a></h3>
<p>Postorius uses Michael Foord&#8217;s <tt class="docutils literal"><span class="pre">mock</span></tt> library for mocking. There are some
shortcuts you can use to quickly create mock objects that behave a little bit like
objects retreived from mailman.client, like:</p>
<ul class="simple">
<li>Domains</li>
<li>Mailing Lists</li>
<li>Users</li>
<li>Memberships</li>
<li>Addresses</li>
</ul>
<div class="section" id="mocking-mailman-client-objects">
<h4>Mocking mailman.client objects<a class="headerlink" href="#mocking-mailman-client-objects" title="Permalink to this headline">¶</a></h4>
</div>
</div>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h3><a href="index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Development</a><ul>
<li><a class="reference internal" href="#testing">Testing</a><ul>
<li><a class="reference internal" href="#running-the-tests">Running the tests</a></li>
<li><a class="reference internal" href="#mocking">Mocking</a><ul>
<li><a class="reference internal" href="#mocking-mailman-client-objects">Mocking mailman.client objects</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="setup.html"
                        title="previous chapter">Installation</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="_sources/development.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="setup.html" title="Installation"
             >previous</a> |</li>
        <li><a href="index.html">Postorius 1.0a2 documentation</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2012, The Free Software Foundation.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.2.
    </div>
  </body>
</html>