Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Mechanize support for Django testcases.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 djangomechanize
Octocat-spinner-32 testproject
Octocat-spinner-32 README.rst
Octocat-spinner-32 requirements.txt
Octocat-spinner-32 setup.py
Octocat-spinner-32 tests.py
README.rst

Mechanize support for Django testcases.

Testcases are subclasses of DjangoMechanizeTestCase.

The mechanize browser is accessed via self.browser. Your test will fetch URLs from a virtual server running your Django project. This defaults to http://localhost:17681 - use self.browser_url() to avoid hardcoding that address.

e.g:

::
class MyTestCase(DjangoMechanizeTestCase):
def test_with_mechanize(self):
self.browser.open(self.browser_url('/test_view/')) self.browser.select_form(name='upload_form') self.browser.add_file(StringIO('12341234'), 'text/plain', 'test.txt') self.browser.submit()
Something went wrong with that request. Please try again.