Closed Bug 792087 Opened 12 years ago Closed 12 years ago

[socorro-crashstats] write unit test for especially complex signatures

Categories

(Socorro :: Webapp, task)

task
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: rhelmer, Assigned: peterbe)

References

Details

We have had a lot of issues with signature escaping in Socorro, most recently bug 753382.

We should have a test that ensures that these are escaped in a way that's useable for passing over the the middleware (since it's python on both sides I hope this to be easier).
Blocks: 788003
Assignee: nobody → peterbe
I messed around with the signatures a bit and the formatting on top crashers works at least. 
http://cl.ly/Jv0O

(I did that by editing the json file in ./models-cache/socorro-api-dev-fakedata.allizom.org/crashes/signatures/product/water...)

Then because I wanted to check that these signatures actually become exactly like that in the middleware I redirected the ReportList model to go to `http://localhost:8882` instead where I run a local middleware copy of the new configmanized-middleware. In there, I did this::
  
 from pprint import pprint
 pprint(sql_params)

...to see what the parameters become just before they are sent into `cursor.execute(sql_query, sql_params)` and here's the output::

127.0.0.1:51305 - - [04/Oct/2012 09:53:57] "HTTP/1.1 GET /report/list/signature/FakeSignature2/versions/WaterWolf:5.0a1/fields/signature/search_mode/contains/from/2012-09-27 00:00:00/report_type/any/report_process/any/result_number/250/result_offset/0" - 200 OK
{'from_date': datetime.datetime(2012, 9, 27, 0, 0, tzinfo=<isodate.tzinfo.Utc object at 0x1011ebbd0>),
 'limit': 250,
 'offset': 0,
 'term': u'FakeSignature1 <script>',
 'to_date': datetime.datetime(2012, 10, 4, 16, 56, 8, 595222, tzinfo=<isodate.tzinfo.Utc object at 0x1011ebbd0>),
 'version0': u'WaterWolf',
 'version1': u'5.0a1'}
127.0.0.1:51432 - - [04/Oct/2012 09:56:08] "HTTP/1.1 GET /report/list/signature/FakeSignature1 <script>/versions/WaterWolf:5.0a1/fields/signature/search_mode/contains/from/2012-09-27 00:00:00/report_type/any/report_process/any/result_number/250/result_offset/0" - 200 OK
{'from_date': datetime.datetime(2012, 9, 27, 0, 0, tzinfo=<isodate.tzinfo.Utc object at 0x1011ebbd0>),
 'limit': 250,
 'offset': 0,
 'term': u'FakeSignature2 1   2 = 3',
 'to_date': datetime.datetime(2012, 10, 4, 16, 56, 9, 324991, tzinfo=<isodate.tzinfo.Utc object at 0x1011ebbd0>),
 'version0': u'WaterWolf',
 'version1': u'5.0a1'}
127.0.0.1:51438 - - [04/Oct/2012 09:56:09] "HTTP/1.1 GET /report/list/signature/FakeSignature2 1 + 2 = 3/versions/WaterWolf:5.0a1/fields/signature/search_mode/contains/from/2012-09-27 00:00:00/report_type/any/report_process/any/result_number/250/result_offset/0" - 200 OK
{'from_date': datetime.datetime(2012, 9, 27, 0, 0, tzinfo=<isodate.tzinfo.Utc object at 0x1011ebbd0>),
 'limit': 250,
 'offset': 0,
 'term': u'onedivided/bytwo',
 'to_date': datetime.datetime(2012, 10, 4, 16, 56, 10, 101832, tzinfo=<isodate.tzinfo.Utc object at 0x1011ebbd0>),
 'version0': u'WaterWolf',
 'version1': u'5.0a1'}

As you can see the actual content of the signatures is preserved perfectly!!


Pull request here: https://github.com/mozilla/socorro-crashstats/pull/117
https://github.com/mozilla/socorro-crashstats/commit/01bf5b138312e41768f99151c3e501c5580e6761
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.