~launchpad-pqm/python-oops-tools/trunk

« back to all changes in this revision

Viewing changes to src/oopstools/oops/test/test_dboopsloader.py

  • Committer: Tarmac
  • Author(s): Robert Collins
  • Date: 2011-10-31 02:15:41 UTC
  • mfrom: (7.1.2 bug-881400)
  • Revision ID: launchpad@pqm.canonical.com-20111031021541-28m630kl18eu34mx
Handle bad url bytestrings by url quoting. Also release 0.6.1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
154
154
        report = { 'url': 'foo', 'id': 'testnotopichandling'}
155
155
        oops = parsed_oops_to_model_oops(report, 'bug_880641')
156
156
        self.assertEqual('', oops.pageid)
 
157
 
 
158
    def test_broken_url_handling(self):
 
159
        # This URL is not a valid URL - URL's are a subset of ASCII.
 
160
        broken_url = '/somep\xe1th'
 
161
        report = { 'url': broken_url, 'id': 'testbrokenurl'}
 
162
        # We handle such URL's by url quoting them, failing to do so being a
 
163
        # (not uncommon) producer mistake.
 
164
        expected_url = urllib.quote(broken_url)
 
165
        oops = parsed_oops_to_model_oops(report, 'test_broken_url_handling')
 
166
        self.assertEqual(expected_url, oops.url)
 
167