~lifeless/python-oops-tools/prune

« back to all changes in this revision

Viewing changes to src/oopstools/oops/test/bug-672984.txt

  • Committer: Robert Collins
  • Date: 2011-10-13 20:18:51 UTC
  • Revision ID: robertc@robertcollins.net-20111013201851-ym8jmdhoeol3p83s
Export of cruft-deleted tree.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
= Load an OOPS with a HTTP REQUEST_METHOD header too long =
 
2
 
 
3
This test makes sure the fix for
 
4
https://bugs.launchpad.net/oops-tools/+bug/672984 works.
 
5
 
 
6
A sample OOPS with the broken header was added:
 
7
 
 
8
Try to load that OOPS using the OopsLoader.
 
9
 
 
10
    >>> from django.conf import settings
 
11
    >>> from oopstools.oops.dboopsloader import OopsLoader
 
12
    >>> from oopstools.oops import helpers
 
13
    >>> from datetime import date
 
14
    >>> loader = OopsLoader()
 
15
    >>> start_date = date(2009, 7, 31)
 
16
    >>> helpers._today = start_date
 
17
    >>> found_oopses = loader.find_oopses(start_date=start_date)
 
18
    >>> from pprint import pprint
 
19
    >>> pprint(
 
20
    ...     [(oops, oops.http_method) for oops in
 
21
    ...      sorted(found_oopses, key=lambda oops: oops.date)])
 
22
    [(<Oops: OOPS-1308X1>, u'1234567890')] 
 
23
 
 
24
Reset the database.
 
25
 
 
26
    >>> from oopstools.oops.helpers import reset_database
 
27
    >>> reset_database()
 
28
    'Oops, DBOopsRootDirectory and Infestation deleted.'