(mocker)
| 68 | |
| 69 | |
| 70 | def test_internal(mocker): |
| 71 | assert "dash" in ComponentRegistry.registry |
| 72 | mocker.patch("dash.development.base_component.ComponentRegistry.registry") |
| 73 | ComponentRegistry.registry = {"dash", "dash.dcc", "dash.html"} |
| 74 | |
| 75 | mocker.patch("dash.dcc._js_dist") |
| 76 | mocker.patch("dash.dcc.__version__") |
| 77 | mocker.patch("dash.html._js_dist") |
| 78 | dcc._js_dist = _monkey_patched_js_dist # noqa: W0212, |
| 79 | dcc.__version__ = "1.0.0" |
| 80 | |
| 81 | app = dash.Dash( |
| 82 | __name__, assets_folder="tests/assets", assets_ignore="load_after.+.js" |
| 83 | ) |
| 84 | app.layout = dcc.Markdown() |
| 85 | |
| 86 | assert app.scripts.config.serve_locally and app.css.config.serve_locally |
| 87 | |
| 88 | with mock.patch("dash.dash.os.stat", return_value=StatMock()): |
| 89 | with mock.patch("dash.dash.importlib.import_module", return_value=dcc): |
| 90 | resource = app._collect_and_register_resources( |
| 91 | app.scripts.get_all_scripts() |
| 92 | ) |
| 93 | |
| 94 | assert resource == [ |
| 95 | "/_dash-component-suites/" "dash/external_javascript.v1_0_0m1.js", |
| 96 | "/_dash-component-suites/dash/external_css.v1_0_0m1.css", |
| 97 | "/_dash-component-suites/dash/fake_dcc.v1_0_0m1.js", |
| 98 | ] |
| 99 | |
| 100 | assert ( |
| 101 | "fake_dcc.min.js.map" in app.registered_paths["dash"] |
| 102 | ), "Dynamic resource not available in registered path {}".format( |
| 103 | app.registered_paths["dash"] |
| 104 | ) |
| 105 | |
| 106 | |
| 107 | def test_collect_and_register_resources(mocker): |
nothing calls this directly
no test coverage detected
searching dependent graphs…