Skip to content

Commit 0d1828b

Browse files
committed
unit test
1 parent c32ca56 commit 0d1828b

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/unit/test_resources.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import mock
22
import dash
33
from dash import dcc, html # noqa: F401
4+
import sys
45

56
from dash.development.base_component import ComponentRegistry
67

@@ -102,3 +103,24 @@ def test_internal(mocker):
102103
), "Dynamic resource not available in registered path {}".format(
103104
app.registered_paths["dash"]
104105
)
106+
107+
108+
def test_collect_and_register_resources(mocker):
109+
110+
app = dash.Dash(
111+
__name__, assets_folder="tests/assets", assets_ignore="load_after.+.js"
112+
)
113+
with mock.patch("dash.dash.os.stat", return_value=StatMock()):
114+
with mock.patch("dash.dash.importlib.import_module") as import_mock:
115+
sys.modules["dash_html_components"] = dcc
116+
117+
import_mock.return_value = dcc
118+
app._collect_and_register_resources(
119+
[
120+
{
121+
"namespace": "dash_html_components",
122+
"relative_package_path": "dash_html_components.min.js",
123+
},
124+
]
125+
)
126+
import_mock.assert_any_call("dash_html_components")

0 commit comments

Comments
 (0)