refactoring: Replaced occurences of create_stream_if_needed.

Issue #2088 asked for a wrapper to be created for
`create_stream_if_needed` (called `ensure_stream`) for the 25 times that
`create_stream_if_needed` is called and ignores whether the stream was
created. This commit replaces relevant occurences of
`create_stream_if_needed` with `ensure_stream`, including imports.

The changes weren't significant enough to add any tests or do any
additional manual testing.

The refactoring intended to make the API easier to use in most cases.
The majority of uses of `create_stream_if_needed` ignored the second
parameter.

Fixes: #2088.
This commit is contained in:
Jack Weatherilt
2018-03-21 21:05:21 +00:00
committed by Tim Abbott
parent 11c995b70f
commit 3396cfc2ef
7 changed files with 40 additions and 33 deletions

View File

@@ -24,7 +24,7 @@ from zerver.lib.actions import (
do_reactivate_realm,
do_reactivate_user,
do_set_realm_authentication_methods,
create_stream_if_needed,
ensure_stream,
)
from zerver.lib.mobile_auth_otp import otp_decrypt_api_key
from zerver.lib.validator import validate_login_email, \
@@ -931,7 +931,7 @@ class GoogleSubdomainLoginTest(GoogleOAuthTest):
stream_names = ["new_stream_1", "new_stream_2"]
streams = []
for stream_name in set(stream_names):
stream, _ = create_stream_if_needed(realm, stream_name)
stream = ensure_stream(realm, stream_name)
streams.append(stream)
# Without the invite link, we can't create an account due to invite_required