PIG208
495a8476be
tests: Use assertion to enforce None-checks in tests.
...
This fixes a batch of mypy errors of the following format:
'Item "None" of "Optional[Something]" has no attribute "abc"
Since we have already been recklessly using these attritbutes
in the tests, adding assertions beforehand is justified presuming
that they oughtn't to be None.
2021-07-24 09:54:21 -07:00
Dinesh
c4463ee34c
test_example.py: Add a new example to demonstrate mocking.
...
Took the help of our mocking docs:
https://zulip.readthedocs.io/en/latest/testing/testing-with-django.html#testing-with-mocks
and rewrote a part of
test_message_edit.EditMessageTest.test_edit_message_content_limit
using mock.patch().
2021-07-08 10:04:20 -04:00
Dinesh
a71ee405e4
test_example: Add a few more common testing methods.
...
Adds an example to illustrate the use of:
* self.settings()
* self.assertLogs()
* self.assert_in_success_response()
2021-06-20 07:16:35 -04:00
Tim Abbott
3eee7c067c
test_example: Add discussion of other common pitfalls.
...
The new test_example file is great; here I document more pitfalls that
I've seen very often with tests contributed by folks new to the
project.
2021-06-07 16:02:12 -07:00
Steve Howell
47da28429b
tests: Add test_example.py.
...
The idea here is to quickly learn basic testing
idioms with code that's executed (unlike docs
which are prone to bitrot).
2021-06-07 15:29:49 -07:00