Commit Graph

38317 Commits

Author SHA1 Message Date
Anders Kaseorg 9c7a3cc0f4 compose: Replace accidental usage of underscore for “translation”.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-26 16:08:52 -07:00
Steve Howell da8691d7d7 ci: Add new check-node-fixtures tool to CI.
This tool only takes a couple seconds to run,
so it's pretty low risk to add to CI.
2020-07-26 16:07:40 -07:00
Steve Howell f9808d0c15 tools: Add tools/check-node-fixtures.
This makes sure out fixture data for node tests
is realistic, according to the schemas in
zerver/lib/event_schema.py.

Note that we are still in the process of extracting
schemas from test_events.py -> event_schema.py,
so the checks here are somewhat incomplete as of
now.

One nice thing is that the program will tell us
what checkers are missing, so this can motivate
us to move more checkers to event_schema.py.

I considered just making this happen as part of
tools/test-js-with-node, but it's convenient to
run by itself.  Also, it currently requires
Django (although we could fix that), which makes
it just expensive enough that I wouldn't want
to always run it before the node tests.
2020-07-26 16:07:33 -07:00
Steve Howell 0eb206f97e mobile sharing: Make emoji.js a shared ES6 module.
This is a pretty straightforward conversion.

The bulk of the diff is just changing emoji.js
to ES6 syntax.

There is one little todo that can be deferred
to the next commit--we are now set up to have
markdown.js require emoji.js directly, since
it is no longer on `window`.
2020-07-26 16:07:17 -07:00
Steve Howell a028aa5f8a emoji refactor: Avoid util dep with minor hack.
We copy in a one-line function from util that
will soon be replaced with lodash.
2020-07-26 16:07:17 -07:00
Steve Howell 92ed76e3c1 emoji refactor: Pass in emoji_codes from ui_init.
We don't want emoji.js to depend on a JSON file
(and specifically the location of said JSON file)
when we start sharing our code with mobile.
2020-07-26 16:07:17 -07:00
Steve Howell 3e30a7f66e emoji refactor: Move function higher in file.
This preps for ES6 linting rules.  (And it's
nicer for now, too.)
2020-07-26 16:07:17 -07:00
Steve Howell 979c126b07 emoji refactor: Avoid unnecessary exports.
`default_emoji_aliases` was around for a while, and
the `server_realm_emoji_data` was added really
recently by me (oops).
2020-07-26 16:07:17 -07:00
Steve Howell e7e3760588 tests: Extract markdown test for missing emojis.
We now show before/after, and we don't complicate
our other test that runs in a big loop.

And we take advantage of function injection to
not have to hack into the "real" emoji_codes
structure.

Note that we're simulating the missing emojis
at a slightly higher level, but we already had test
coverage that emoji.get_emoji_name returns
undefined for unknown codepoints.
2020-07-26 16:07:17 -07:00
Steve Howell 91de92ce2f ui_init test: Test with real emoji.js. 2020-07-26 16:07:17 -07:00
Steve Howell aedf1660f8 dispatch tests: Make realm_emoji test more robust.
The main thing here is that we check that the
actual data got put into our data structures.

(In general we want to move away from stubbing
data modules; any place where we stub data modules
is a relic of earlier days, where we were just
trying to set the bar for 100% line coverage,
even though some of the original coverage was
quite shallow.)

I also use real stubs instead of noops for
the calls out to UI-oriented modules.

In passing I tweak some comments in the actual
dispatch code.
2020-07-26 16:07:17 -07:00
Steve Howell 69c082e2f6 refactor: Have emoji_picker pull from emoji.
This makes it so that the authoritative holder
of all emoji data is emoji.js, and all our
UI components that need emoji data consistently
pull data from emoji.js as needed.

Or to put it another way, we no longer need the
dispatch module to know that emoji_picker is
coupled to emoji precisely by the active_realm_emojis
data; it can now make fewer assumptions.
2020-07-26 16:07:17 -07:00
Steve Howell 6e9d9b42ca refactor: Rename func to emoji_picker.rebuild_catalog. 2020-07-26 16:07:17 -07:00
Steve Howell ef40767edf emoji: Promote blueslip.error to caller.
The only function that called blueslip had only
one caller, and we are trying to get emoji.js
ready for ES6.
2020-07-26 16:07:17 -07:00
Steve Howell 65ea339a47 emoji tests: Clean up data setup.
With update_emojis, it is pretty easy
to set up the tests with reasonable
data without reaching into internal
data structures.

Also, we can begin the process of
sharing the same data with our
dispatch tests (upcoming).
2020-07-26 16:07:17 -07:00
Priyank Patel 51199878ed tools/ci: Fix KeyError when running tools/ci/generate-dockerfiles.
This KeyError occurs because we remove extra_packages from
images.yml because it was no longer needed in a486872a8e.
2020-07-26 16:03:35 -07:00
Mateusz Mandera 9d1f77edc5 saml: Use self.logger in get_issuing_idp.
get_issuing_idp is no longer a class method, so that akward logger
fetching can be skipped and self.logger can be accessed.
2020-07-26 15:48:48 -07:00
Mateusz Mandera 389c190d49 saml: Fix incorrect settings object being passed in get_issuing_idp.
Fixes #15904.

settings is supposed to be a proper OneLogin_Saml2_Settings object,
rather than an empty dictionary. This bug wasn't easy to spot because
the codepath that causes this to demonstrate runs only if the
SAMLResponse contains encrypted assertions.
2020-07-26 15:48:48 -07:00
palash aba53551ec test: Add order_by in query for RealmAuditLog.
Added order_by("id") clause in query for RealmAuditLog
for consistent output.
It was causing zerver.tests.test_audit_log.TestRealmAuditLog
to fail due to order mismatch.
2020-07-26 15:47:16 -07:00
Steve Howell 28f5dfefea dispatch tests: Use run_test. 2020-07-26 12:50:07 -04:00
Steve Howell d0378b07c7 dispatch test: Remove unneeded blueslip wrapper.
I think this became irrelevant when I moved some
of the code to dispatch_subs a couple months ago.
2020-07-26 12:50:07 -04:00
Steve Howell 978c179e19 node tests: Tweak stream_sort to use run_test. 2020-07-26 12:50:07 -04:00
Steve Howell 7c8dd45da3 node tests: Simplify message_list overrides. 2020-07-26 12:50:07 -04:00
Steve Howell 0d68a23066 zjsunit: Handle duplicate overrides.
We want to undo overrides in reverse order,
which is important if you override the
same name more than once in the same
function.

Until today the code basically prevented
us from ever using the original implementation
of a name we stubbed, and most of them start
as undefined due to their parent modules
starting with `set_global`.

But I do want this proper, and I introduced
a tiny pitfall today.
2020-07-26 12:50:07 -04:00
Steve Howell 10bb60e13d node test: Use override in more places.
I also removed some useless stubs in passing.
2020-07-26 12:50:07 -04:00
Steve Howell c9bb6ab843 node tests: Simplify stream_events.
We use the new override helper passed in to
run_test.
2020-07-26 12:50:07 -04:00
Steve Howell ccfcd2c9ae zjsunit: Have run_test pass in override helper.
The subsequent commits will make it more clear
how this helps.
2020-07-26 12:50:07 -04:00
Steve Howell b086e987b8 zjsunit: Prevent spurious function overrides.
If you use the with_overrides() helper, we will
now detect bogus stubs.
2020-07-26 09:25:40 -04:00
Steve Howell 23e14124aa zjsunit: Only allow functions for overrides.
There was only one place where we weren't
overriding a function, and the use case there
was fairly unique.

Knowing that we're dealing with only functions
will simplify override and allow us to add
features like detecting spurious stubs.
2020-07-26 09:25:40 -04:00
Steve Howell b8b2e31463 zjsunit: Require explicit set_global for overrides.
This forces us to more explicitly document at the
top of the file what dependencies we are stubbing,
plus it's less magical.

Also, we may want to do occasional audits of
set_global to clean up places where we mock
things like stream_data, which are probably just
easier to use the real version of now that we
have cleaner APIs to set up stream data.

The modules most affected by this change are our
dispatch-oriented tests--basically, all the
modules that test handling of Zulip events
plus hotkey.js.
2020-07-26 09:25:40 -04:00
Steve Howell 128cda6acd zjsunit: Restore functions in with_overrides.
Before we were making it impossible to reuse
the function again (so we were preventing
leaks), but it's fine to just restore the
original function, especially now that some
of our tests have grown bigger.
2020-07-26 09:25:40 -04:00
Steve Howell 48bb432e4f dispatch tests: Localize overrides. 2020-07-26 09:25:40 -04:00
Steve Howell 7de8726000 dispatch tests: Remove obsolete noop stubs. 2020-07-26 09:25:40 -04:00
Steve Howell a6a9897abd node fixtures: Clean up user_group data. 2020-07-25 17:55:57 -04:00
Steve Howell 97c21ff4da node fixtures: Add all flags for update_message_flags. 2020-07-25 17:55:57 -04:00
Steve Howell 2462282631 node fixtures: Add users for various settings.
We should probably remove this field, as it
seems extraneous.
2020-07-25 17:55:57 -04:00
Steve Howell f22d0b8abe node fixtures: Add op for custom_profile_fields. 2020-07-25 17:55:57 -04:00
Steve Howell b63c7d1cbb node fixtures: Add more realistic data for typing. 2020-07-25 17:55:57 -04:00
Steve Howell b4a4f9d568 node fixtures: Add more realistic data for streams/subs. 2020-07-25 17:55:57 -04:00
Steve Howell 7092cbf6f5 node fixtures: Add more realistic data for user events. 2020-07-25 17:55:57 -04:00
Steve Howell aad98aa6cd node fixtures: Add more realistic data for bots. 2020-07-25 17:55:57 -04:00
Anders Kaseorg 0ed9a0fc58 eslint: Forbid imports from outside shared in shared.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-25 12:29:47 -07:00
Anders Kaseorg 7727dae441 shared: Add missing katex dependency to shared package.json.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-25 12:22:25 -07:00
Vishnu KS 5b0b1efb15 support: Add functionality to approve sponsorship requests.
This should make it much easier to process these requests.
2020-07-24 17:55:38 -07:00
Vishnu KS d3834f8b9a emails: Simplify requested by line in sponsorship email. 2020-07-24 17:39:46 -07:00
Vishnu KS 6b9c22b211 support: Add a header for scrub realm section. 2020-07-24 17:37:41 -07:00
Vishnu KS 1a1396d07e support: Show customer plan details in support page. 2020-07-24 17:37:41 -07:00
Vishnu KS f6cbb9177a models: Add plan_name attribute to CustomerPlan. 2020-07-24 17:37:41 -07:00
Alex Vandiver 38d01cd4db puppet: Generalize install-wal-g to be arbitrary tarballs. 2020-07-24 17:24:57 -07:00
Anders Kaseorg b900e38dc6 topic_list: Convert widget to an ES6 class TopicListWidget.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-24 16:58:22 -07:00