Commit Graph

38552 Commits

Author SHA1 Message Date
Mohit Gupta 8b9deb9c71 test_realm: Use assertLogs to avoid spam in test-backend output. 2020-07-27 11:02:17 -07:00
Mohit Gupta 82646e27c2 test_realm_export: Use assertLogs in endpoint tests to verify info log.
This is to avoid spam in test-backend output.
2020-07-27 11:02:17 -07:00
Mohit Gupta 3eda7586f3 test_queue_worker: Use assertlogs to verify logs while testing workers.
This will avoid spam in output of test-backend.
2020-07-27 11:02:17 -07:00
Mohit Gupta 732f1fa44d test_queue: Use assertLogs to verify warning in test_queue_error_json.
This will avoid spam in test-backend output.
2020-07-27 11:02:17 -07:00
Mohit Gupta 68b9f0b3cf tests: User assertLogs to verify info logs while soft deactivation.
This will avoid spamming of test-backend output.
2020-07-27 11:02:17 -07:00
Ryan Rehman 15c5dadb73 message view: Move live update logic of stream name to `message_store`. 2020-07-27 11:00:31 -07:00
Ryan Rehman 131a1dd54f message view: Move live update logic of avatar url to `message_store`. 2020-07-27 11:00:31 -07:00
Ryan Rehman 06d0dc1ffa message view: Move live update logic of full name to `message_store`.
This is done to decouple our message view related update events
from MessageListData as there are plans to create multiple
MessageListData objects. Instead we update the `stored_messages`
which tracks the complete data for all messages.
2020-07-27 11:00:31 -07:00
Ryan Rehman e85bc853d6 message list: Refactor and update API to include `rerender_view`.
This is a necessary prep commit as our message live update
functions will call this function, outside the MessageList class.
2020-07-27 11:00:31 -07:00
Steve Howell 64894fe8e4 node tests: Avoid "orig_foo = bar" idiom.
We use either override or with_field, as
appropriate.
2020-07-27 11:07:41 -04:00
Steve Howell 329f38975e zjsunit: Add with_field helper.
This just lets us temporarily assign a value
to a field.

Differences with the "override" scheme:

    * override only works on globals
    * override (when passed in via run_test) will
      just automatically clean up at the end of
      the function
2020-07-27 11:07:41 -04:00
Dinesh 2e864d487e puppeteer: Add subscriptions test and required functions.
Tests stream subscriptions and stream creation.
2020-07-26 17:10:56 -07:00
Dinesh 2835092010 puppeteer: Make fill_form function empty text fields before filling. 2020-07-26 17:10:56 -07:00
Dinesh 56c5e0318f puppeteer: Remove set_pm_recipient.
Previous commit introduced same function in pm_recipient object.
So, this comit removes the duplicate `set_pm_recipient`.
2020-07-26 17:10:56 -07:00
Dinesh 4998e32b10 puppeteer: Add compose tests and required functions in common.js.
Thanks to Priyank Patel for helping debug flakes.
2020-07-26 17:10:56 -07:00
Anders Kaseorg 0b4483c8d2 settings_panel_menu: Convert make_menu to an ES6 class SettingsPanelMenu.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-26 17:00:05 -07:00
Anders Kaseorg 025f49dbc4 poll_widget: Convert poll_data_holder to an ES6 class PollData.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-26 17:00:05 -07:00
Anders Kaseorg 2e94914be4 list_cursor: Convert list_cursor to an ES6 class ListCursor.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-26 17:00:05 -07:00
Anders Kaseorg 9d90ae0e69 fetch_status: Convert FetchStatus to an ES6 class.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-26 17:00:05 -07:00
Anders Kaseorg a1796325de buddy_list: Convert buddy_list_create to an ES6 class BuddyList.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-26 17:00:05 -07:00
Anders Kaseorg a1295936a4 message_list_view: Convert MessageListView to an ES6 class.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-26 17:00:05 -07:00
Anders Kaseorg 8e5574fbe6 message_list_data: Convert MessageListData to an ES6 class.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-26 17:00:05 -07:00
Anders Kaseorg 7249103ab4 message_list: Convert MessageList to an ES6 class.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-26 17:00:05 -07:00
Steve Howell 49db62c240 refactor: Have markdown depend directly on emoji.
Now that emoji is in our shared library, we can
require it directly from markdown without
re-introducing any `window` dependencies.
2020-07-26 16:50:14 -07:00
orientor 7bb5fac8e0 test_message_send: Mark tests using intentiionally undocumented features.
Some parameters such as `to` and `topic` have been intentionally
undocumentecd hence fail request validation. So mark tests which
fail due to this accordingly.
2020-07-26 16:26:57 -07:00
orientor bdf9d912e3 test_classes: Use OpenAPI request validator for validating requests.
Expand the `validate_api_response_openapi` function to also validate
requests to ensure better testing.
2020-07-26 16:26:57 -07:00
orientor c91c106cfb openapi_py: Change condition for invalid requests.
Change the condition for allowing failed validation to the condition
that `if the test fails, response status code begins with 4`. Also
add `intentionally_undocumented` argument in `validate_request` for
allowing passing of tests which return `200` responses but fail
validation due to some intentionally undocumented feature in
OpenAPI specification.
2020-07-26 16:26:56 -07:00
Mohit Gupta 8b8cfb2e73 test_link_embed: Add assertLogs to prevent spam in test-backend. 2020-07-26 16:14:17 -07:00
Mohit Gupta 0ca3c1d904 test_home: Use assertLogs to test info logs by do_soft_deactivate_users.
This will verify logs without spamming test-backend output.
2020-07-26 16:14:17 -07:00
Mohit Gupta 85fcd0ad99 test_events: Use assertLogs to avoid spam in test-backend output. 2020-07-26 16:14:17 -07:00
Mohit Gupta 4928b55996 test_cache: Use assertLogs to avoid spam in test-backend output. 2020-07-26 16:14:17 -07:00
Mohit Gupta 133a5f2a7c tests: Add assertLogs for test_auth_backends.
This commit tests logging of warning log using assertLogs instead of
printing it in test output hence avoiding spam in test output.
2020-07-26 16:14:17 -07:00
Mohit Gupta 67a67fcc02 tests: Avoid "import logging" and setting root logger level in tests.
Use assertLogs to avoid spamming the test-backend output.
2020-07-26 16:14:17 -07:00
Mohit Gupta c4fe91af74 test_push_notifications: Add assertLogs to verify logging in tests.
This will prevent spam in test-backend output and test logging of logs
by the code being tested.
2020-07-26 16:14:17 -07:00
Anders Kaseorg d2520cd7e0 js: Replace underscore with lodash and remove it from globals.
Tweaked by tabbott to bump PROVISION_VERSION.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-26 16:12:06 -07:00
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