test_docs: Add assertion check.

In the test case `test_check_if_every_integration_has_logo_that_exists`,
`urlsplit(integration.logo_url).path` gets inferred as possibly bytes
because `integration.logo_url` might be `None`.

5598b49851/stdlib/urllib/parse.pyi (L166-L169)

TODO:
We might want to ensure that every integration has a `logo_url` with an
explicit assertion in `Integrations` (as noted in the comment).

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
This commit is contained in:
Zixuan James Li 2022-07-22 18:33:09 -04:00 committed by Tim Abbott
parent 4e240b880e
commit 07eccbde97
2 changed files with 2 additions and 0 deletions

View File

@ -91,6 +91,7 @@ class Integration:
self.categories = list(map((lambda c: CATEGORIES[c]), categories))
self.logo_path = logo if logo is not None else self.get_logo_path()
# TODO: Enforce that all integrations have logo_url with an assertion.
self.logo_url = self.get_logo_url()
if display_name is None:

View File

@ -320,6 +320,7 @@ class HelpTest(ZulipTestCase):
class IntegrationTest(ZulipTestCase):
def test_check_if_every_integration_has_logo_that_exists(self) -> None:
for integration in INTEGRATIONS.values():
assert integration.logo_url is not None
path = urlsplit(integration.logo_url).path
self.assertTrue(os.path.isfile(settings.DEPLOY_ROOT + path), integration.name)