How to test url in django
<p>I would like to test my url in django but I got error message. </p>

<p>here are my codes:</p>

<p>urls.py</p>

<pre><code>url(r'^create/(?P&lt;userName&gt;[0-9a-zA-Z-]+)/$', views.create, name='create'),
</code></pre>

<p>test.py</p>

<pre><code>from django.test import TestCase, Client

client = Client()


def test_create(self):
    """Test the url for "create"
    """

    response = self.client.get('/mission/create/' + str(self.userName))
    self.assertEqual(response.status_code, 200)
</code></pre>

<p>and i would get this result:</p>

<pre><code>FAIL: test_create (mission.tests.MissionUrlTests)
Test the url for "create"
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/actinbox/mission/tests.py", line 122, in test_create
    self.assertEqual(response.status_code, 200)
AssertionError: 301 != 200
</code></pre>

<p>Please help me with my codes here. Thank you in advance.</p>