-
-
Notifications
You must be signed in to change notification settings - Fork 584
/
test_docs_util.py
30 lines (23 loc) · 996 Bytes
/
test_docs_util.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Copyright 2019 Victor Torre
#
# SPDX-License-Identifier: Apache-2.0
import testtools
import bandit
from bandit.core.docs_utils import get_url
class DocsUtilTests(testtools.TestCase):
"""This set of tests exercises bandit.core.docs_util functions."""
BASE_URL = f"https://bandit.readthedocs.io/en/{bandit.__version__}/"
def test_overwrite_bib_info(self):
expected_url = self.BASE_URL + (
"blacklists/blacklist_calls.html" "#b304-b305-ciphers-and-modes"
)
self.assertEqual(get_url("B304"), get_url("B305"))
self.assertEqual(expected_url, get_url("B304"))
def test_plugin_call_bib(self):
expected_url = self.BASE_URL + "plugins/b101_assert_used.html"
self.assertEqual(expected_url, get_url("B101"))
def test_import_call_bib(self):
expected_url = self.BASE_URL + (
"blacklists/blacklist_imports.html" "#b413-import-pycrypto"
)
self.assertEqual(expected_url, get_url("B413"))