Rafid Aslam
41bd88d5ed
pep8: Fix E301 pep8 violations.
...
Fix "E301: expected (1 or 2) blank line" pep8 violations.
2016-11-29 08:51:44 -08:00
Rafid Aslam
7a2282986a
pep8: Fix E225 pep8 violations.
2016-11-28 15:21:15 -08:00
reyha
9f8630fed8
tests: Access realms by string_id.
...
Replaces get_realm() function by get_realm_by_string_id() function
in zerver/tests.
Fixes #2226 .
2016-11-15 13:32:20 -08:00
sinwar
4582a98c09
tests: Split out ZulipTestCase and WebhookTestCase to a separate file.
...
Fixes #1671 .
2016-11-10 19:29:43 -08:00
Umair Khan
ee3ec96f38
Django 1.10: Suppress logs.
2016-11-10 16:20:03 +05:00
Umair Khan
1e91b946d9
Django 1.10: Sign google oauth requests using csrf token.
...
In Django 1.10, the get_token function returns a salted version of
csrf token which changes whenever get_token is called. This gives
us wrong result when we compare the state after returning from
Google authentication servers. The solution is to unsalt the token
and use that token to find the HMAC so that we get the same value
as long as t he token is same.
2016-11-10 16:20:03 +05:00
Rishi Gupta
1e6ae537bd
Remove special flow for open realm sign-up when realms have subdomains.
...
Redirects /register/<domain> to /accounts/register when
REALMS_HAVE_SUBDOMAINS.
2016-11-09 16:31:48 -08:00
Rishi Gupta
ff2fe0cf92
forms.HomepageForm: Improve error messages.
...
No change to behavior.
2016-11-09 16:31:48 -08:00
Rishi Gupta
01526677c4
forms.HomepageForm: Use string_id to determine intended signup realm.
...
If the user comes in to HomepageForm with a set subdomain, use that to
determine the signup realm instead of the email address.
In the non-REALMS_HAVE_SUBDOMAINS case, still allow using the email address
if no subdomain is passed.
2016-11-09 16:31:48 -08:00
Umair Khan
f78752466c
Django 1.10: URLs in response contain just the path.
...
The response object of the Django test client only contains the
path of the url.
2016-11-09 15:26:07 -08:00
umkay
ab2fd4ef3a
TestAdminSetBackends: Supply dev_auth_enabled() with realm argument.
...
This fixes the fact that these tests were not correctly running
against the actual realm.
2016-11-07 17:07:05 -08:00
Tim Abbott
11518d9fb3
Remove test_ldap_auth_email_auth_disabled_failure for now.
...
This test was having order-dependent failures when run after
`test_signup`.
2016-11-06 18:34:22 -08:00
Tim Abbott
bb17e575c8
auth: Add SocialAuthMixinTest.
2016-11-06 18:07:52 -08:00
Tim Abbott
c856e56afc
test_auth_backend: Add missing LDAP tests in FetchAPIKeyTest.
2016-11-06 18:07:52 -08:00
Tim Abbott
c94fe5bdef
test_ldap: Fix spelling of tearDown method.
2016-11-06 16:33:20 -08:00
umkay
f4c621ffe3
admin: Enable admins to toggle supported auth methods via UI.
...
Add a table to the administration page that will allow realm admins to
activate and deactivate the supported authentication methods for that
realm.
2016-11-06 16:29:35 -08:00
umkay
21c024fc29
auth: Make supported authentication backends a bitfield on realm.
...
This makes it possible to configure only certain authentication
methods to be enabled on a per-realm basis.
Note that the authentication_methods_dict function (which checks what
backends are supported on the realm) requires an in function import
due to a circular dependency.
2016-11-06 16:16:24 -08:00
Tim Abbott
b41c15fa05
auth: Reject authentication if auth backends are disabled.
2016-11-06 16:16:22 -08:00
Tim Abbott
3a3cee411d
auth: Remove old password_auth_enabled hack.
...
This was used by an old configuration for zulip.com, which is no
longer in production use.
2016-11-06 14:50:15 -08:00
Umair Khan
4502872e8e
subdomain: Test user registration through Google OAuth.
2016-11-03 10:09:24 -07:00
Rishi Gupta
64bcd71d6e
models.Realm: Rename subdomain to string_id.
...
Does a database migration to rename Realm.subdomain to
Realm.string_id, and makes Realm.subdomain a property. Eventually,
Realm.string_id will replace Realm.domain as the handle by which we
retrieve Realm objects.
2016-11-02 22:46:34 -07:00
umkay
0e0a11bb5e
Refactor GitHub authentication backend tests.
2016-11-02 21:06:17 -07:00
Umair Khan
2dabfc562c
subdomains: Add tests for single domain OAuth2.
2016-10-28 11:04:08 -07:00
Umair Khan
26646abe8c
Authenticate subdomains using single Google OAuth entry.
...
Previously, we used to create one Google OAuth callback url entry
per subdomain. This commit allows us to authenticate subdomain users
against a single Google OAuth callback url entry.
2016-10-28 11:04:08 -07:00
Umair Khan
d139c9cb71
Add tests for maybe_send_to_registration function.
2016-10-28 09:27:56 -07:00
Umair Khan
8064ed1c0b
Add test for ZulipRemoteUserBackend.
2016-10-28 09:27:56 -07:00
Umair Khan
839cab3434
Add tests for GitHubAuthBackend.
2016-10-28 09:27:56 -07:00
Umair Khan
b6046bc77e
Add tests for password_auth_enabled function.
2016-10-28 09:27:56 -07:00
Umair Khan
d9e1975d2c
Add ZulipAuthMixin tests.
2016-10-28 09:27:56 -07:00
Umair Khan
6dbe425675
Add Google OAuth2 backend tests.
2016-10-28 09:27:56 -07:00
Umair Khan
088d8eebad
Add ZulipLDAPUserPopulator test.
2016-10-28 09:27:56 -07:00
Umair Khan
50422e775b
Add LDAP tests.
2016-10-28 09:27:55 -07:00
Umair Khan
486774b28d
Add tests for JWT based login.
2016-10-26 14:40:56 -07:00
Umair Khan
9b42b7fad3
Add tests for TestZulipRemoteUserBackend.
2016-10-25 08:13:35 -07:00
Umair Khan
9f37b9b386
Add tests for TestDevAuthBackend.
2016-10-25 17:57:33 +05:00
Tim Abbott
67d9e19ccf
views: Split views/auth.py out of core views file.
2016-10-11 21:27:06 -07:00
Umair Khan
b886e38a58
Increase test quality for GitHubAuthBackendTest.
2016-10-11 16:19:55 -07:00
Umair Khan
4fcd36b124
Add negative tests for Social auth backend.
...
Fixes : #1948
2016-10-11 16:19:55 -07:00
Umair Khan
4fa427bc74
auth_backends: Add backend tests for subdomains logic.
...
Fixes : #1870
2016-10-10 08:55:39 -07:00
Umair Khan
d0acda4635
Google: Show error on login page for wrong subdomain.
...
Takes care of Google OAuth.
Fixes : #1871
2016-10-10 08:42:34 -07:00
Umair Khan
c23aaa1785
GitHub: Show error on login page for wrong subdomain.
...
While logging in through GitHub, if the user tries to login
to the wrong subdomain then show an appropriate message.
2016-10-10 08:42:34 -07:00
Tim Abbott
e93a2e990f
Fix nondeterministic parsing failures in GoogleLoginTest.
...
Apparently, in urllib.parse, one need to extract the query string from
the rest of the URL before parsing the query string, otherwise the
very first query parameter will have rest of the URL in its name.
This results in a nondeterministic failure that happens 1/N of the
time, where N is the number of fields marshalled from a dictionary
into the query string.
2016-09-13 18:13:28 -07:00
Tim Abbott
6d8af06e32
Fix Google oauth2 logging to use %s for strings.
...
This has more consistent results in Python 2 vs. Python 3.
2016-09-13 17:30:39 -07:00
Tim Abbott
95a348382b
Fix nondeterministic failures in GoogleLoginTest.
2016-09-13 17:26:38 -07:00
Tim Abbott
b8bdf1365b
tests: Add a Google web authentication test suite.
2016-09-13 17:08:14 -07:00
Steve Howell
fd6ee7117f
tests: Renamed AuthedTestCase to ZulipTestCase.
2016-08-22 19:07:44 -07:00
Umair Khan
35dd1ffb13
Pass password as string to authenticate.
2016-08-08 15:17:01 -07:00
Umair Khan
266c791e64
Email should be a unicode.
2016-08-08 15:17:01 -07:00
Umair Khan
0dfc757447
Annotate test_auth_backends.py.
2016-08-08 15:12:12 -07:00
Tim Abbott
cc11229377
test_auth_backends: Add missing type annotations.
2016-08-04 15:57:02 -07:00
Umair Khan
b38ca0c690
Add tests for GitHub team and organization auth.
2016-08-03 12:01:15 -07:00
Umair Khan
fc1d8e217f
Don't pass `return_data` to mock functions.
...
GitHubAuthBackend already passes the `return_data` keyword argument
to the `do_auth` function.
2016-08-03 12:01:15 -07:00
Tim Abbott
6b2b7ab3ff
Rename GitHubBackend to GitHubAuthBackend for consistency.
2016-07-29 12:49:10 -07:00
Umair Khan
d43b031a32
Add tests to verify GitHub backend.
2016-07-29 12:49:10 -07:00
Steve Howell
6937f63fd5
Add client_get() test helper.
2016-07-27 20:49:33 -07:00
Steve Howell
38f2a2f475
Add client_post() test helper.
...
This makes us more consistent, since we have other wrappers
like client_patch, client_put, and client_delete.
Wrapping also will facilitate instrumentation of our posting code.
2016-07-27 20:49:32 -07:00
Eklavya Sharma
c98c3d5f8d
Re-enable some backend tests on python 3.
2016-07-12 14:06:29 -07:00
Eklavya Sharma
d740a87d04
zerver/tests: Use unicode strings.
...
* Use unicode strings for strings containing non-ASCII characters.
* Decode response content when text output is expected.
2016-07-12 14:06:29 -07:00
Eklavya Sharma
73a3c9fa47
On python 3, skip expected failures in backend tests.
2016-07-12 09:27:55 -07:00
acrefoot
a36e5d4987
Add get_auth_backends endpoint to API.
...
We would like to know which kind of authentication backends the server
supports.
This is information you can get from /login, but not in a way easily
parseable by API apps (e.g. the Zulip mobile apps).
2016-06-27 18:30:34 -07:00
kunall17
007eee6061
Add route to fetch emails for mobile passwordless login.
...
[Tweaked by tabbott to rename API to explicitly support not just
Android]
2016-06-17 11:03:19 -07:00
kunall17
7ea0eaed1c
Add passwordless login for mobile app development.
...
[Tweaked by tabbott to rename API to explicitly support not just
Android].
2016-06-17 10:58:33 -07:00
Tim Abbott
6fba0879a4
Annotate much of the rest of zerver/tests.
2016-06-04 11:53:20 -07:00
Nathan Florea
04c71fadc6
More removal of mutable default arguments.
...
I've left a few that clearly aren't being passed and aren't being mutated, but
I think I've gotten the rest of them.
2016-06-03 09:17:04 -07:00
Tim Abbott
37015fd7c5
Run mypy on zerver/lib/test_auth_backends.py.
2016-06-02 23:01:15 -07:00
Tim Abbott
f2aee961e1
test_auth_backends: Fix unused variables.
2016-05-10 11:46:39 -07:00
Tim Abbott
be216506a9
Improve api_fetch_api_key error messages.
...
Previously, api_fetch_api_key would not give clear error messages if
password auth was disabled or the user's realm had been deactivated;
additionally, the account disabled error stopped triggering when we
moved the active account check into the auth decorators.
2016-05-10 09:50:57 -07:00
Tim Abbott
52ddd500f0
Add tests for authentication backends.
2016-05-10 09:50:57 -07:00