This fixes the code to limit the results returned by max_questions and max_documents. Further, it adds tests for this behavior so that it's less likely to break again in the future when I'm making changes. It also tweaks _make_question() and _make_document() to have a timestamp in the title to prevent slug collisions.
This switches document results to use DocumentDetailSerializer. It also fixes DocumentDetailSerializer to include the document summary which is on the current revision and the document url.
I have no idea if this is the format we want to go with, but it is some documentation. Maintaining it will be painful. It's probably better for us to figure out a way to autogenerate the documentation or somehow move the documentation to the code. That work is covered in bug #1164247.
This refactors the search suggest API to use more DRF-y things including built-in DRF-y validation. In the process of doing this, I changed it so that you can provide the filter parameters in the querystring OR in the HTTP request body as JSON.
This fixes the search suggest api to return an HTTP 400 if you try to filter on an invalid locale. Further, it fixes the questions search so that it filters on locale--previously, it didn't. Adds some additional tests for behavior that wasn't previously tested.
The -stage environment is somehow different than the -dev, -prod and all developer environments such that the code we have for measuring the rabbitmq queue size is erroring out. We were faced with two options: 1. remove the problematic code and thus unblock the Django 1.7 upgrade 2. try to fix code that we know is fragile because it uses private methods which is broken on only one environment for reasons we don't understand and in a way we can't easily observe the specifics of or test fixes for We chose the first option because the second option is clearly a slippery slope to giving up and becoming a potato farmer. Also, yay for -stage environments that differ in mysterious ways from -prod.
Bugzilla returns JSON with utf-8 encoded strings which get converted to unicode. So the bugzilla-using code is always dealing with unicode. git data is pulled from the command line as byte strings. As such, it's utf-8 encoded strings. This commit straightens out the code so that we have everything as unicode types and then explicitly encode as utf-8 when printing to the command line.
This wraps two strings in gettext and fixes a pluralization issue.
nose has a skip plugin which enhances SkipTest raising beyond our wildest imaginations. However, there are certain occasions where we want skipped things to not skip with reckless abandon but instead don the malevolent cloak of errorhood. nose has a --no-skip argument for exactly this sort of sordid thing, but it's totally busted and doesn't work. This changes the code around so that it works correctly.
The previous version of the qunit test used nose generators to split each qunit test into a nose test. That's great, but the setup/teardown was "shared" by all the tests which means they had to run in a specific order with teardown as the last test. That breaks the requirement that tests run independently of one another in any order. Further, the setup actually executed at collection time, so it'd spin up a browser with the qunit page and then at some point down the line, the tests would run and examine the contents of that browser window. This rewrite fixes that by squashing it into one nose test. It prints output like this for individual test failures: QUNIT FAIL: in "declarative": None != None ====================================================================== FAIL: kitsune/sumo/tests/test_qunit.py:TestQunit.test_qunit ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/willkg/mozilla/kitsune/kitsune/sumo/tests/test_qunit.py", line 59, in test_qunit eq_(total_fails, 0, 'One or more Qunit tests failed; see output for details') File "/home/willkg/.virtualenvs/kitsune/lib/python2.7/site-packages/nose/tools.py", line 31, in eq_ assert a == b, msg or "%r != %r" % (a, b) AssertionError: One or more Qunit tests failed; see output for details It'll print a QUNIT FAIL line for each test that failed.
This adds a patch call to manage.py. The problem is that various Django-specific subcommands at some point import Jingo which eventually results in a circular import. Adding the patch call here guarantees that Jingo and all that stuff is imported before we import the things we need to import to execute the subcommand.