Commit Graph

108 Commits

Author SHA1 Message Date
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
Zev Benjamin 195bdb07c9 Unify huddles and personals into private messages on the send path
Personals are now just private messages between two people (which
sometimes manifests as a private message with one recipient).  The
new message type on the send path is 'private'.  Note that the receive
path still has 'personal' and 'huddle' message types.

(imported from commit 97a438ef5c0b3db4eb3e6db674ea38a081265dd3)
2012-11-13 15:40:53 -05:00
Keegan McAllister 31496e9189 Generalize Tornado-related settings
(imported from commit 76a1338a87e1a6663aa7602a499e2d769814bf08)
2012-11-13 10:59:02 -05:00
Tim Abbott 30b43ebee2 Uniformize /json/ and /api/ URLs to end with no trailing slash.
(imported from commit c35b30bcc43982db3a2f774ea69269e5424a6159)
2012-11-09 14:30:10 -05:00
Zev Benjamin 565edc3c5a Fix tests failing due to changes in error message text
(imported from commit 1b0a869d427b33a0e8fcec4e2aa083bd94eee640)
2012-11-09 14:21:06 -05:00
Tim Abbott 831316c6a6 Fix tests failing due to new activity tracking.
(imported from commit 9c7ddfd4ad40cd2dfd38ac41537e058e02797085)
2012-11-09 14:16:52 -05:00
Keegan McAllister 3b8dbbc7d7 Use django.utils.timezone.now consistently
(imported from commit f223d9c1f6c77012db342b8be7aaed964b9f18c6)
2012-11-07 18:51:33 -05:00
Keegan McAllister 0d538d91ac test: Fail if generate-fixtures fails
(imported from commit b13167ad04837cfeb64989ff43fec2e6ae890a33)
2012-11-07 17:46:46 -05:00
Jessica McKellar 9eb86df03a tests: Unbreak registration, which was missing the new TOS field.
Also remove unused fields.

The registration tests should be revamped for our new multi-stage
signup, but for now just get the test suite passing completely.

(imported from commit 481f420cf99341e44e71942ae563e3f9a1270d3e)
2012-11-05 10:32:42 -05:00
Keegan McAllister ac6a74bd73 test_public_urls: Fix docstring
(imported from commit 18bf6595386ca65e0a928c9e0b60e8e0a46f77e2)
2012-11-02 14:57:38 -04:00
Keegan McAllister cb9cdf22c3 tests: Correct documentation on test_message_to_nonexistent_stream
(imported from commit 76176083c1a0494856a3507214e2cfc3844d1fc1)
2012-11-01 12:08:38 -04:00
Tim Abbott 30aab26ccd Fix test_missing_last_received to match current behavior.
(imported from commit 101b08d740ddf46d100c9763f2b78b86e2b07a00)
2012-10-30 16:59:25 -04:00