Commit Graph

105 Commits

Author SHA1 Message Date
rht 8242c15b48 zerver/lib: Remove unused imports (F401). 2017-11-07 16:37:13 -08:00
rht 19bd335cbb Change urllib import to be Python 3-specific. 2017-11-07 10:46:42 -08:00
neiljp (Neil Pilgrim) 692e2150c6 mypy: Explicitly specify List[Any] in test_classes.py. 2017-11-04 19:47:45 -07:00
rht fef7d6ba09 zerver/lib: Remove u prefix from strings.
License: Apache-2.0
Signed-off-by: rht <rhtbot@protonmail.com>
2017-11-03 15:34:37 -07:00
Greg Price 26edde21f7 alias domains: Tweak a test helper that assumes hosts are subdomains.
Because this is for tests, a heuristic like this that's right in most
situations is actually fine; we can override it in the few cases where
a test might set up a situation where it fails.

So just make it clear for the next reader that that's what's going on,
and also adjust the helper's interface slightly so that its callers
do have that flexibility.
2017-10-30 18:29:29 -07:00
Steve Howell b3192d17ab refactor: Extract get_stream_subscriptions_for_user(). 2017-10-29 18:36:35 -07:00
Steve Howell d6c47573b2 Eliminate ZulipTestCase.send_message().
Now all tests use these three messages instead:

    send_stream_message
    send_personal_message
    send_huddle_message
2017-10-28 10:20:59 -07:00
Greg Price 6d403ff255 tests: Simplify set_http_host to dedupe its logic.
This will make it easier to change this logic.
2017-10-27 14:42:24 -07:00
Steve Howell 4b78f69a87 tests: Introduce send_huddle_message().
The tighter interface here makes for shorter lines (or
fewer multi-line calls) and it leads to stricter type
checking.
2017-10-27 11:00:23 -07:00
Steve Howell 9707767b21 tests: Introduce send_personal_message().
The tighter interface prevents the need to specify
Recipient.PERSONAL (which can often be inaccurate in the
huddle case, anyway), and it prevents tests from confusingly
specifying a "subject" field for PMs.
2017-10-27 11:00:23 -07:00
Steve Howell 25a6fbd05d tests: Introduce send_stream_message().
Having send_stream_message() avoids the need to supply
Recipient.STREAM as a parameter, and it also uses the more
modern name of `topic_name` for topics.  Under the hood, it
avoids some annoying steps for re-formatting the recipients,
since we just have a single stream name.
2017-10-27 11:00:23 -07:00
derAnfaenger e041abd300 tests: Add create_test_bot() helper function. 2017-10-25 15:46:07 -07:00
Tim Abbott 85917a7269 subdomains: Improve support for using the root domain.
This modifies the realm creation form to (1) support a
realm_in_root_domain flag and (2) clearly check whether the root
domain is available inside check_subdomain_available before trying to
create a realm with it; this should avoid IntegrityErrors.
2017-10-18 23:38:55 -07:00
Tim Abbott 2604eb0a07 test_classes: Refactor submit_reg_form_for_user.
This is a pure refactor in preparation for adding another argument.
2017-10-18 23:30:51 -07:00
derAnfaenger 5ddc336844 tests: Add welcome bot as user. 2017-10-11 20:45:42 -07:00
Steve Howell 9202777d7f tests: Provide more useful output in assert_length(). 2017-10-06 14:30:30 -07:00
rht 035ed93111 zerver/lib: remove `import six`. 2017-09-27 19:10:28 -07:00
rht 2e12fe5e2e zerver/lib: Remove print_function. 2017-09-27 18:05:45 -07:00
Tim Abbott c3911e3fb6 test_classes: Improve error handling for send_message. 2017-09-27 15:55:29 -07:00
rht f43e54d352 zerver/lib: Remove absolute_import. 2017-09-27 10:00:39 -07:00
Robert Hönig c77b245944 backend tests: Add 'AARON' as bot owner of OUTGOING_WEBHOOK_BOT. 2017-09-26 16:11:27 -07:00
Tim Abbott c5d699b6fb tests_classes: Add DEFAULT_SUBDOMAIN feature.
This should make life a little easier for those tests that need to use
the same subdomain like 20 times.
2017-08-28 23:17:33 -07:00
Tim Abbott 4a22316d90 test_decorator: Add explicit subdomains in tests. 2017-08-28 22:51:57 -07:00
Tim Abbott a8b9ffc020 test_classes: Include more detail in incorrect JSON responses.
If the status code is wrong, we show the actual error message now,
which often saves a bit of time when debugging.
2017-08-28 21:43:41 -07:00
Tim Abbott 27101ae931 trello: Use client_head wrapper in tests. 2017-08-26 13:45:27 -07:00
Tim Abbott d18f389bb5 test_messages: Set subdomain explicitly in most tests. 2017-08-26 13:45:27 -07:00
rht e2e56a3e71 test_subs: Fix dict unpacking. 2017-08-26 09:01:10 -07:00
Tim Abbott edc095db6d test_subs: Explicitly declare subdomains. 2017-08-25 16:09:51 -07:00
Tim Abbott 7a5eb9dd9f tornado: Add support for testing with subdomains. 2017-08-25 15:42:58 -07:00
Tim Abbott 43cfe73908 tests: Make requests use the "zulip" subdomain by default.
Previously, we didn't pass customized HTTP_HOST headers when making
network requests.  As we move towards a world where everything is on a
subdomain, we'll want to start doing that.

The vast majority of our test code is written to interact with the
default "zulip" realm, which has a subdomain of "zulip".  While
probably longer-term, we'll wish this was the root domain, for now, we
need to make our HTTP requests match what is expected by the test
code.

This commit almost certainly introduces some weird bugs where code was
expecting a different subdomain but the tests doesn't fail yet.  It's
not clear how to find all of these, but I've done some grepping.
2017-08-25 15:42:49 -07:00
Tim Abbott b0c8404622 tests: Add subdomain option to client_get and friends.
This should help make it easy to set the domain explicitly in tests
where that's important.
2017-08-25 15:42:42 -07:00
Tim Abbott 4229faf36e tests: Remove old six.PY2 code paths. 2017-08-25 11:05:16 -07:00
Tim Abbott 50defd9b70 test_classes: Remove some unnecessary functions. 2017-08-24 23:33:12 -07:00
Tim Abbott 7d08ff69f0 tests: Remove most references to get_api_key.
This test helper doesn't really have value.
2017-08-24 23:30:46 -07:00
Tim Abbott 59aae22f99 registration: Fix find_my_team handling of unusual users. 2017-08-24 23:17:08 -07:00
Tim Abbott e915fa058a test_classes: Stop using get_realm_by_email_domain.
get_realm_by_email_domain was intended to be registration flow code
not used in other code, but it was leaked to a few places.  This
removes one of the main remaining references to it outside the
registration code path.
2017-08-24 21:38:02 -07:00
Tim Abbott 95ed00bade tests: Remove now-unused subscribe_to_stream helper. 2017-08-24 21:38:02 -07:00
Tim Abbott 69059dcac8 tests: Clean up subscribing from webhook tests. 2017-08-24 21:37:57 -07:00
Tim Abbott 5fa7c3e0b2 test_classes: Clean up API for unsubscribing.
The old API required test authors to unnecessarily repeat themselves.
2017-08-24 21:37:57 -07:00
Tim Abbott eb720485c5 tests: Add and use new self.subscribe.
This new method cleans up the API for subscribing to something from a
test case.
2017-08-24 21:37:57 -07:00
Umair Khan abed403a81 result.json: Upgrade test_classes. 2017-08-17 09:03:35 -07:00
Jack Zhang e915321f89 registration: Remove organization type selection in realm creation. 2017-07-21 13:09:06 -07:00
Tim Abbott 6ac9bae5f5 bulk_add_subscriptions: Clarify name of from_stream_creation arg.
The old name was ambigious for whether it was about user or stream
creation.
2017-07-17 17:23:41 -07:00
Vishnu Ks 098569ccb4 test_classes: Use get_user in unsubscribe_from_stream. 2017-07-13 14:13:03 -07:00
Vishnu Ks 99e78cbead test_classes: Use get_user in get_streams function. 2017-07-13 14:13:03 -07:00
Vishnu Ks bf729c9a4d test_classes: Use get_user in notification_bot fcuntion. 2017-07-13 00:45:24 +05:30
Vishnu Ks f28b29177b test_classes: Use get_user in mit_user function. 2017-07-13 00:45:24 +05:30
Vishnu Ks 0b701b52df test_classes: Use get_user in example_user function. 2017-07-13 00:45:24 +05:30
Vishnu Ks c5f75a8f3d test_classes: Remove client_put_multipart function.
We are no longer using this method anywhere. Removing this
is essential for making the backend coverage tests to pass.
2017-07-07 10:31:43 -07:00
Rishi Gupta 36cd122905 models: Change default org_type to CORPORATE.
Once we implement org_type-specific features, it'll be easy to change a
corporate realm to a community realm, but hard to go the other way. The main
difference (the main thing that makes migrating from a community realm to a
corporate realm hard) is that you'd have to make everyone sign another terms
of service.
2017-06-29 15:14:58 -07:00