Commit Graph

119 Commits

Author SHA1 Message Date
Leo Franchi 6d30793a02 Add tests for XSS and emails
(imported from commit 9441f65218fa5b102658d0dd48b88fdf826eeef2)
2013-02-01 18:42:27 -05:00
Leo Franchi ea2e816c4c Add tests for auto linkify
(imported from commit 395fc679ffa835f48044fce1e9c1f818581c23c3)
2013-02-01 16:14:29 -05:00
Keegan McAllister 98a7d31374 Add tests for the bold / italic syntax
(imported from commit aaaf87e88d2db8e201d9f98b4e7411cfc56d50c2)
2013-01-31 16:28:57 -05:00
Leo Franchi c7214a7a2c Add test for almost-but-not-quite fence
(imported from commit 26378ffbf33b3d82fe3b1dc5b5afcbc8ffc4ebbb)
2013-01-29 18:02:47 -05:00
Jacob Hurwitz 7c59d41006 Added unit tests for several more methods:
-json/subscriptions/exists
-json/subscriptions/list
-json/subscriptions/add
-json/subscriptions/remove

(imported from commit 95eb5421ac586bea59f749411b54661689946915)
2013-01-29 15:56:16 -05:00
Jacob Hurwitz 09e86903df assertEquals is deprecated in favor of assertEqual
See http://docs.python.org/2/library/unittest.html for details.

(imported from commit 049a4a7e994ff20b8b4fa3b526f197d63118f4c3)
2013-01-29 15:56:16 -05:00
Leo Franchi b157560369 Remove last tests.py dependency on views.py
(imported from commit d667fbfdeb7ec0cf115354cf9a54fd3cdd801b73)
2013-01-28 17:33:08 -05:00
Leo Franchi e249326510 Convert tests to using json api rather than views
(imported from commit 2a997b93e88156e44d47277387641db1ef3b587a)
2013-01-28 16:59:25 -05:00
Leo Franchi 9cc2945c9e Add unit tests for hanging ulists bugdown
(imported from commit 7e225b54d4ab26e4d7cb734fcdbdbe74b7288dd5)
2013-01-25 17:13:13 -05:00
Leo Franchi ba7dcc320c Remove ``` support from code fence
Supporting ``` as a code fence marker complicates the auto-fence
closing, and as per a discussion with Keegan on code-review@, it
is not worth the extra complexity.

(imported from commit 405afb95c4295a02f4677181456caf9d49913ac4)
2013-01-25 17:12:49 -05:00
Leo Franchi 187e8cfa88 Add markdown tests for auto code block ending
(imported from commit 905ce149fd5d601733c2a7e748636c7a66904fbc)
2013-01-25 17:02:57 -05:00
Leo Franchi 556295dd28 Add unit tests for new invite-only streams
(imported from commit 89f19b85a97d4f9a35988d7c7eb29984719523e5)
2013-01-24 17:34:22 -05:00
Tim Abbott 2740f930fe Fix PublicURLTest to actually test for public URLs.
Previously it was just testing that sending a GET request to our
POST-only URLs returned a 400 error.

(imported from commit a510734271385046bbf29166b38c0ecbd104d2da)
2013-01-24 10:58:51 -05:00
Leo Franchi 2c64bf9c89 Add a test for api_get_public_streams
(imported from commit c2409962e61add9f33982f992350bff6051617a9)
2013-01-23 10:46:41 -05:00
Leo Franchi 0e0e5f63bd Add a test class for api_get_profile
(imported from commit e8e06cb14066b4c53b6830a015da84e92c444a62)
2013-01-23 10:46:41 -05:00
Tim Abbott b6345e6c3d tests: Remove incorrect default 'last' value of '1'.
(imported from commit b2cfce7e7197b69d7d7c6c3253c21d0f8d341a98)
2013-01-17 16:18:53 -05:00
Keegan McAllister 67a83e4ef5 tests: Remove inconsistent use of keyword args with InviteUserTest.invite
(imported from commit 5d19da3800ae3c4c63ce22b5cc907f768bf55da9)
2013-01-14 15:58:45 -05:00
Keegan McAllister 38f2498015 tests: Remove set literal in InviteUserTest.test_invalid_stream
This isn't valid syntax in Python 2.6.

(imported from commit 0dc8ef72a27f1c9d559b59d4243948818d1cb75a)
2013-01-14 15:57:54 -05:00
Luke Faraone fc3fecb1af Add test cases for invite functionality.
This involved splitting off into a separate function the second step of
the two-step registration process.

(imported from commit bd1ec9b5abb15d29b0585873daaa54a8d4e26556)
2013-01-14 10:25:27 -05:00
Tim Abbott 1a82741650 Move action functions from models.py to zephyr/lib/actions.py.
(imported from commit 9d577dd53ce7d4c9faf6cc8a56129d684a50811b)
2013-01-11 16:11:03 -05:00
Tim Abbott 77b7c1ead3 Explicitly error out when running tests improperly.
(imported from commit 8224aef3e327010f8ffdcf4dc966a1ccdbb8714c)
2013-01-10 16:59:36 -05:00
Tim Abbott 52589ca6fb Fix running "./manage.py test zephyr --settings=humbug.test_settings"
Previously it wouldn't work due to using the wrong port numbers.

This commit also has the side effect of fixing the fact that our
frontend tests would send real emails and log events to the real
message log.

(imported from commit f2cf400e6061c089627acba2759d588981ecf5bb)
2013-01-10 16:59:36 -05:00
Tim Abbott 39501e5a78 Make the Django-based test suite much faster.
So, I got annoyed that our test suite was taking forever to run:

real	2m13.443s
user	1m32.630s
sys	0m3.748s

Some quick profiling determined that the test suite is spending all of
its time loading the fixtures files (zephyr/fixtures/messages.json)
that it loads for each test case (3s to load that for each test case).
To improve this situation, I cut out from the test database used by
the test suite most of the users, subscriptions, etc. that aren't
being used directly by the test cases.  The impact is a quite
significant speedup:

real	0m15.176s
user	0m9.161s
sys	0m0.508s

We're still spending over a quarter of a second per test, which isn't
great -- but this is at least no longer unbearable.

This commit doesn't make any changes to the populate_db output if you
don't pass the new --test-suite option.

(imported from commit 2334ba5399b33edab3d29ff269fde4ea77ccd48e)
2013-01-08 17:23:55 -05:00
Tim Abbott 83abc08315 Move tornado views to their own file.
(imported from commit e0d9182cbc89a16eedd2846fa17cfba482510565)
2013-01-08 16:53:53 -05:00
Keegan McAllister 50d229fe11 Accept '{}' to mean 'no narrowing', for old mobile clients
(imported from commit 879f6ef846f2a8980a0574372324d8dc8d22c8ed)
2013-01-08 12:18:31 -05:00
Keegan McAllister 3af2bf345a Reinstate server-side narrow filtering
(imported from commit 40f63324a8dff404b504b06bddf303b8c1ad5780)
2013-01-08 12:18:31 -05:00
Keegan McAllister 16de6e43fe tests.py: Add assert_json_error_contains
(imported from commit 5a241af5071b6e711b56f84f56a1ed1f7e7dc262)
2013-01-08 12:18:31 -05:00
Tim Abbott e2292d38b1 Add tests for mirroring of private messages.
(imported from commit 8599d233c98f48a205618f52752a6ce466100d9e)
2013-01-07 15:06:28 -05:00
Jacob Hurwitz 73a8988df3 Fix tests which were sensitive to ordering of parameters
(imported from commit 87948bb8805a41382ba51152329b33b4f2f03937)
2013-01-03 17:22:21 -05:00
Tyler Hallada 7f06681efa Revert "Add "test" to names of test methods so they run"
This reverts commit a590bf6b8ee733893d3410ecb5eebe54141c48ea. This commit broke
the test suite because it was not tested after rebasing with Keegan's changes
to the tests.

(imported from commit 7248a55328609973c5303be6c85eeb5fbfc1475e)
2013-01-03 16:05:40 -05:00
Tyler Hallada 2cffb7e09b Add test for missing params to ChangeSettingsTest
And add "test_" to the beginning of successful_change_settings.

(imported from commit f5c04517ae3b2140b0b3f7d5012a7044ef601cf0)
2013-01-02 18:46:09 -05:00
Tyler Hallada f276ad2dce Add ChangeSettingsTest to test json_change_settings
(imported from commit 7e83dad9be4ffdfcb3631da6c63b18d85c5714eb)
2013-01-02 18:46:09 -05:00
Tyler Hallada dabdbc8c71 Add "test" to names of test methods so they run
GetOldMessagesTest had test methods that weren't included in the test suite
generated by Runner because they did not have "test" in their names. A few
bugs in these methods that were overlooked because of this were also fixed.

(imported from commit a590bf6b8ee733893d3410ecb5eebe54141c48ea)
2013-01-02 18:46:09 -05:00
Keegan McAllister ec1e16f6be tests: Better asserts for better failure messages
(imported from commit 18a485c6edf4c2d7d85098950b29c82c7f5ead42)
2013-01-02 16:10:25 -05:00
Keegan McAllister 15384d473b tests: Fix some tests that weren't running
(imported from commit f0b9462aac53e38495b9d2848923265adc98b246)
2013-01-02 16:10:25 -05:00
Zev Benjamin 4a28359092 Use to_non_negative_int in an additional place
(imported from commit 2e44cdc927499b0f0fd655ebfe00a864a55ae20a)
2012-12-20 14:26:36 -05:00
Zev Benjamin bf5ce4783d Move @has_request_variables error responses to middleware
This will now allow us to use @has_request_variables on helper
functions.

(imported from commit 799d71477654eac7fd8192cfc5bb88b78053532d)
2012-12-20 14:26:36 -05:00
Jeff Arnold db6f03d46d Make the back button work when narrowed
(imported from commit be922b06e7b53ec21751e67a490bb518333c3e6c)
2012-12-19 14:46:31 -05:00
Jessica McKellar 2f1f1fa6be Add tests for /json/get_old_messages.
(imported from commit 36a076af79635a11d9d48439bd92dfa694ed9df6)
2012-12-11 16:07:09 -05:00
Jessica McKellar c9c94c6696 Add unit tests for subscription color requests.
(imported from commit 6eeeefcfe75b78d36cd94c4d02ca3a1f1a3df3ac)
2012-12-03 12:46:27 -05:00
Keegan McAllister 9e5c86b783 Remove unimplemented test case
"Fixes" #274.

(imported from commit 2c2a64a70ecf11c2119fbb695cba05011cf78f8a)
2012-11-28 15:28:14 -05:00
Keegan McAllister 07ff10e308 Fix / prune tests of get_updates
The assertion-checking callbacks were never called before.  Now they will at
least get called when the view invokes handler.finish() before returning, i.e.
the return_messages_immediately case.

I fixed up the assertion-checking callback for one of the test cases.  For the
other two it wasn't clear what to do -- one has been known-broken for a long
time -- so I just removed them.

"Fixes" #277 in as much as that test case is gone now.

(imported from commit 82d1db26f36f82f24aa5b7ff9e5aa65ce24c9a8f)
2012-11-28 15:28:14 -05:00
Keegan McAllister b5dccbfa87 Return a special value to initiate longpolling
Fixes #261.

(imported from commit dd0312c3574c9ca924ab76edcb2fb6c03085be32)
2012-11-28 15:28:14 -05:00
Zev Benjamin da2c079503 Use Django's built-in @require_POST decorator
Theirs returns an actual 405

(imported from commit 31be790b0f53d7b63d7d3cd85972b16add3d8c74)
2012-11-26 11:52:50 -05:00
Tim Abbott 6026c80de6 API: Add unsubscribe function.
(imported from commit 6dc55e9030770500770ce3921a4e77499d64f2d6)
2012-11-16 17:06:01 -05:00
Tim Abbott afc62a8e16 [manual] Uniformize the subscriptions API method names.
This requires a zephyr_mirror deployment when it is pushed to prod.

(imported from commit 6543441fb264b518f8705d7989d068a1d50ce5d6)
2012-11-16 17:06:01 -05:00
Keegan McAllister 2a619a0054 tests.py: Allow skipping generate-fixtures with --skip-generate
(imported from commit ca3de89fc5cd71e3a60b173275edf7cf74d65cdf)
2012-11-16 15:33:38 -05:00
Keegan McAllister a2750943e3 Use a custom Django test suite runner
This allows us to define new command-line arguments for 'manage.py test'.

(imported from commit 11cf24694a54a3b717256903b7582ddec9a85587)
2012-11-16 15:33:38 -05:00
Tim Abbott 411a7f6b4f [manual] send_message: Rename recipient/stream fields to 'to'.
This commit changes APIs and requires and update of all zephyr
mirroring bots to deploy properly.

(imported from commit 2672d2d07269379f7a865644aaeb6796d54183e1)
2012-11-15 15:30:06 -05:00
Zev Benjamin 4497ef1493 Basic API tests
These tests don't have the same coverage as the json test on the
theory that the backend is shared by the two views and that
differences are mostly on the way into the backend functions.

(imported from commit ddd21135565122dae8cbe90846d1aee7e4a2f56e)
2012-11-15 13:42:17 -05:00