Closed
Bug 1091732
Opened 10 years ago
Closed 8 years ago
Don't write JSON as big fat strings in tests
Categories
(Socorro :: Webapp, task)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: peterbe, Assigned: peterbe, Mentored)
Details
(Whiteboard: [good first bug])
Attachments
(1 file)
In the early days of switching to Django we would write the mock fixtures (the stuff that pretends we talked to the middleware) as big blobs of JSON as a multiline string. Later we made some changes so that you can write it as a python dict and it would automatically make it a JSON object in the mock fixtures. Example that we want to get rid of: https://github.com/mozilla/socorro/blob/40abbb6cd50c86a82aa9c3122003a539c6494989/webapp-django/crashstats/crashstats/tests/test_views.py#L297-L389 Example of what it should look like: https://github.com/mozilla/socorro/blob/40abbb6cd50c86a82aa9c3122003a539c6494989/webapp-django/crashstats/crashstats/tests/test_views.py#L279-L295 The reason it's better to write it as a python dict is that it checks for typos automatically (you'll immediately get a clear SyntaxError if you typo a comma) and you get syntax highlighting.
Assignee | ||
Updated•10 years ago
|
Whiteboard: [good first bug]
Updated•9 years ago
|
Mentor: adrian
Assignee | ||
Comment 1•9 years ago
|
||
This might become partially obsolete as we're going to stop depending on the middleware later this month.
Comment 2•8 years ago
|
||
Hi I am doing this as my first bug fix, can you guide me in which files I need to edit? Thank you.
Flags: needinfo?(peterbe)
Assignee | ||
Comment 3•8 years ago
|
||
(In reply to Denis Marchin from comment #2) > Hi I am doing this as my first bug fix, can you guide me in which files I > need to edit? Thank you. Hi! To find the places where you need to change, look at the examples mentioned in the description of this bug. Then, you'll have to search and grep to find other occurances where it happens. Find us #breakpad if you get stuck.
Flags: needinfo?(peterbe)
Comment 4•8 years ago
|
||
(In reply to Peter Bengtsson [:peterbe] from comment #3) > (In reply to Denis Marchin from comment #2) > > Hi I am doing this as my first bug fix, can you guide me in which files I > > need to edit? Thank you. > > Hi! To find the places where you need to change, look at the examples > mentioned in the description of this bug. Then, you'll have to search and > grep to find other occurances where it happens. Find us #breakpad if you get > stuck. Hi Peter, I think I've fixed it. How do I make a patch and submit it. I tried looking into the mozzila guide on how to generate a patch but it uses ./mach which the Socorro repo doesn't have. Also, how would I test if my fixes are correct? Thank you.
Comment 5•8 years ago
|
||
(In reply to Peter Bengtsson [:peterbe] from comment #3) > (In reply to Denis Marchin from comment #2) > > Hi I am doing this as my first bug fix, can you guide me in which files I > > need to edit? Thank you. > > Hi! To find the places where you need to change, look at the examples > mentioned in the description of this bug. Then, you'll have to search and > grep to find other occurances where it happens. Find us #breakpad if you get > stuck. Hi Peter okay so I am just doing pull requests as Lars told me from the #breakpad irc. Travis is failing and giving me a bunch of ISO8601Error: Unrecognised ISO 8601 date format: u'%(end_date)s' errors. I have no idea what these are. Here is the link to the travis report: https://travis-ci.org/mozilla/socorro/builds/111923398 and a link to my pull request https://github.com/mozilla/socorro/pull/3221 Thanks.
Assignee | ||
Comment 6•8 years ago
|
||
Comment 7•8 years ago
|
||
Commits pushed to master at https://github.com/mozilla/socorro https://github.com/mozilla/socorro/commit/56bf7189b53d18f1eb8041a36b0725a6dcf36f05 bug 1091732 - No Response as JSON strings in crashstats/test_views.py https://github.com/mozilla/socorro/commit/9cceeb5c3f00c7a32085ed0175ef761aa8ae3058 bug 1091732 - No Response as JSON strings in api/test_views.py https://github.com/mozilla/socorro/commit/fbbbb790130369d1b8b90738383ada29221a9ce4 bug 1091732 - No Response as JSON strings in crashstats/test_models.py https://github.com/mozilla/socorro/commit/6eca80756c6f8c9b97e022a4ebfc603b5cbd6c42 Merge pull request #3329 from peterbe/bug-1091732-dont-write-json-as-big-fat-strings-in-tests bug 1091732 - No Response as JSON strings in crashstats/test_views.py
Assignee | ||
Updated•8 years ago
|
Assignee: nobody → peterbe
Assignee | ||
Comment 8•8 years ago
|
||
I'm pretty sure we've cleaned up all these places when we moved the fetching of raw and processed crashes directly via implementation instead of via the middleware.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•