Commit Graph

40444 Commits

Author SHA1 Message Date
Steve Howell 2ad879cdda node tests: Use override in echo.js. 2021-02-13 12:48:15 -08:00
Nishant Mittal f659744720 ui: Fix detection of narrow window.
Fixes #17280.
2021-02-13 07:14:24 -08:00
Steve Howell 9698fec008 node tests: Use override for snapshot_message.
Using override ensures that the real code actually
calls the stubs here.

The one-line map() helper avoids some ugliness
from "prettify".
2021-02-13 08:50:10 -05:00
Abhijeet Prasad Bodas c183076a91 minor: Suggest with_field instead of override for non-functions. 2021-02-13 07:28:26 -05:00
Abhijeet Prasad Bodas a24d8272e8 zjsunit: Remove with_stub helper.
This doesn't add much clarity to the tests.
Using scoped stub objects is preferred instead.
2021-02-13 06:48:59 -05:00
Abhijeet Prasad Bodas 0d770c32cc node tests: Explicitly call make_stub.
This commit replaces all `with_stub` calls and
explicitly calls `make_stub` instead.
The `with_stub` helper does not add much clarity
hence we now use scoped stub objects instead.

This de-indents some blocks where scoping isn't
required, for example when there is a single
stub object inside a `run_test` function.

With this change, we also need to explicitly
assert `num_calls`.
2021-02-13 06:48:59 -05:00
Anders Kaseorg a0d0b89adb docs: Document Black and isort.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-12 15:31:59 -08:00
Anders Kaseorg db1c9a9448 docs: Remove obsolete note about unused imports.
We started prohibiting them in #11654.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-12 15:09:59 -08:00
Tim Abbott 0f4d5cd90a pycodestyle: Improve comments documenting excludes. 2021-02-12 13:11:25 -08:00
Anders Kaseorg f21fbea7c7 lint: Replace (most of) pycodestyle with Black.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-12 13:11:19 -08:00
Anders Kaseorg 6e4c3e41dc python: Normalize quotes with Black.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-12 13:11:19 -08:00
Anders Kaseorg 11741543da python: Reformat with Black, except quotes.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-12 13:11:19 -08:00
Anders Kaseorg 5028c081cb python: Merge concatenated string literals that Black would uglify.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-12 13:11:19 -08:00
Anders Kaseorg d8d0e7dfff prod_settings_template: Distinguish text from commented code with ##.
This allows the distinction to survive Black reformatting.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-12 13:11:19 -08:00
Steve Howell 183c51ba51 node tutorial: Add make_stub example. 2021-02-12 12:11:23 -05:00
Steve Howell a5a5863bde node tutorial: Use override in helpers. 2021-02-12 12:11:23 -05:00
Steve Howell 69ddf68f4d node tutorial: Inline setup.
This code didn't make sense to run inside its own
run_test wrapper.
2021-02-12 12:11:23 -05:00
Steve Howell 118a212af8 node tutorial: Add with_field example. 2021-02-12 12:11:23 -05:00
Steve Howell 7672e7dd7b node tutorial: Use override() more.
This is just a better practice.
2021-02-12 12:11:23 -05:00
Steve Howell ba7e49c20e node tutorial: Use set_global for overlays. 2021-02-12 12:11:23 -05:00
Steve Howell 70fb1c225b minor: Clarify that message_store is a deep test.
I believe the original message_store example used
to stub some things here, but the part of the tutorial
that pertains to stubbing is further down.
2021-02-12 12:11:23 -05:00
Steve Howell c0874462dc node tests: Rename general.js to tutorial.js. 2021-02-12 12:11:23 -05:00
Steve Howell 1598344fa7 zjsunit: Rename `module` argument to `obj`.
Due to recent changes, `with_overrides` is no longer
constrained to overriding module methods.  You can
override methods on any type of object.
2021-02-12 12:11:23 -05:00
Steve Howell 21cb0d1547 minor: Suggest using with_field instead of override. 2021-02-12 12:11:23 -05:00
Alex Vandiver 559cdf7317 puppet: Set APT::Periodic::Unattended-Upgrade in apt config.
This is required for unattended upgrades to actually run regularly.
In some distributions, it may be found in 20auto-upgrades, but placing
it here makes it more discoverable.
2021-02-12 08:59:19 -08:00
Anders Kaseorg 1a4f70f1bc lint: Convert sudo exclusion to double quotes.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-12 08:34:43 -08:00
Anders Kaseorg 07efcf61d4 lint: Disable pycodestyle E203.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-12 08:34:43 -08:00
Anders Kaseorg 1323c4aa6e pyproject: Configure Black.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-12 08:34:43 -08:00
Anders Kaseorg 9773c0f1a8 python: Fix string literal concatenation mistakes.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-12 08:02:51 -05:00
Alex Vandiver a315579140 settings: Move LDAP configuration together, in the same order.
Match the order of the variables between `default_settings.py` and
`settings.py`, and move the defaults into `default_settings.py` so
the section does not require any uncommented lines in `settings.py` if
LDAP is not in use.
2021-02-11 17:23:46 -08:00
Steve Howell 16ad65dd66 zjsunit: Restrict overrides to once-per-function.
We can relax this restriction in the future, but
basically every time it came up for me, the test
code was just disorganized, or it had an easy
workaround.
2021-02-11 11:29:21 -05:00
Steve Howell 90730a18d9 node tests: Simplify stream_events.
These are still kind of a mess.

The old code combined the worst of both worlds:

    - we had one monolithic test
    - we called the events multiple times,
      verifying a different stub each time

Now I make the tests more granular.

We could actually re-combine the tests, but
in a nicer way, so that we just set
up multiple stubs and verify that all stubs
get correctly invoked.
2021-02-11 11:29:21 -05:00
Steve Howell fcf5a66aeb node tests: Move streams tests to dispatch_subs.
There is also some code cleanup here--in dispatch_subs,
we don't stub stream_data, so it's easier to write
deeper tests that actually validate the data changes.
2021-02-11 11:29:21 -05:00
Steve Howell 90ca1ded13 node tests: Split up dispatch tests. 2021-02-11 11:29:21 -05:00
Steve Howell 6f25a372ab node tests: Reuse message_list stubs.
We now just override these functions to close
on local variables.
2021-02-11 11:29:21 -05:00
Anders Kaseorg e9220c7d50 js: Convert static/js/huddle_data.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-11 07:35:28 -05:00
Anders Kaseorg 741c0ac8ca node_tests: Change stub/events pattern to work with non-global modules.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-11 07:35:28 -05:00
Anders Kaseorg 2f6c9b8d0e zjsunit: Change override API to work with non-global modules.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-11 07:35:28 -05:00
Anders Kaseorg 2024859d74 dependencies: Upgrade JavaScript dependencies.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 15:55:49 -08:00
Steve Howell d67cc2d080 slugs: Fix regex for legacy stream slugs.
This prevents a bug where we interpret "2something"
as a modern slug instead of a legacy stream name.

The bug was probably somewhat unlikely to happen in
practice, since it only manifests if 2 is an actual
stream_id.
2021-02-10 14:37:34 -08:00
Anders Kaseorg 34b98a1cf6 js: Convert static/js/util.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 3a110e6419 js: Convert static/js/stats/stats.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 7a0c2e0d6f js: Convert static/js/settings_data.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg fc2900c004 js: Convert static/js/settings_config.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 5bee572332 js: Convert static/js/portico/signup.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 89cd97ac05 js: Convert static/js/portico/integrations_dev_panel.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 309f6e59a1 js: Convert static/js/portico/email_log.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg da277afa3b js: Convert static/js/portico/dev-login.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 6ab1c1c8a6 js: Convert static/js/portico/desktop-redirect.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 1bfc22e4a1 js: Convert static/js/portico/desktop-login.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00