Package expedient :: Package common :: Package tests :: Module client
[hide private]
[frames] | no frames]

Module client

source code

Created on May 21, 2010

Contains functions to login and manage forms.


Author: jnaous

Classes [hide private]
  Browser
Functions [hide private]
 
fake_login(client, user)
Setup the client to appear logged in even if it isn't.
source code
 
parse_form(doc)
parse the doc (a string), and return a dictionary of name->value.
source code
Test Response instance.
test_get_and_post_form(client, url, params, del_params=[], post_url=None)
Get the form at url, modify named parameters by those in params, then submit at post_url or url if post_url is unspecified.
source code
Variables [hide private]
  logger = logging.getLogger("expedient.common.tests.client")
  __package__ = 'expedient.common.tests'
Function Details [hide private]

fake_login(client, user)

source code 

Setup the client to appear logged in even if it isn't.

Parameters:
  • client (django.test.Client) - The client to setup
  • user (django.contrib.auth.models.User) - The user to log the client in as.

test_get_and_post_form(client, url, params, del_params=[], post_url=None)

source code 

Get the form at url, modify named parameters by those in params, then submit at post_url or url if post_url is unspecified. Return response. This function uses the Django TestClient client.

Parameters:
  • client (Django TestClient.) - client to use to make requests.
  • url (string) - URL to get the form from.
  • params (dict) - parameters to update the form with.
  • del_params (list of strings) - list of parameter names to delete from form. These parameters are not submitted.
  • post_url (str or None) - (optional) URL to post the form to. If None then port to url instead.
Returns: Test Response instance.
response from client.post()