Skip to content

Commit 62f6b6d

Browse files
committed
fix test
1 parent 3c27bb5 commit 62f6b6d

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

tests/integration/dash_assets/test_dash_assets.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,15 @@ def test_dada003_external_resources_with_attributes(dash_duo):
131131
{
132132
"external_url": "https://cdn.example.com/module-script.js",
133133
"attributes": {"type": "module"},
134+
"external_only": True,
134135
}
135136
)
136137

137138
app.scripts.append_script(
138139
{
139140
"external_url": "https://cdn.example.com/async-script.js",
140141
"attributes": {"async": "true", "data-test": "custom"},
142+
"external_only": True,
141143
}
142144
)
143145

@@ -146,6 +148,7 @@ def test_dada003_external_resources_with_attributes(dash_duo):
146148
{
147149
"external_url": "https://cdn.example.com/print-styles.css",
148150
"attributes": {"media": "print"},
151+
"external_only": True,
149152
}
150153
)
151154

tests/unit/test_resources.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,21 +126,23 @@ def test_collect_and_register_resources(mocker):
126126

127127
def test_resources_with_attributes():
128128
"""Test that attributes are passed through in external_url resources"""
129-
app = dash.Dash(__name__, serve_locally=False)
129+
app = dash.Dash(__name__)
130130

131131
# Test external scripts with attributes
132132
resources = app._collect_and_register_resources(
133133
[
134134
{
135135
"external_url": "https://example.com/module.js",
136136
"attributes": {"type": "module"},
137+
"external_only": True,
137138
},
138139
{
139140
"external_url": "https://example.com/script.js",
140141
"attributes": {
141142
"crossorigin": "anonymous",
142143
"integrity": "sha256-abc123",
143144
},
145+
"external_only": True,
144146
},
145147
]
146148
)
@@ -157,18 +159,20 @@ def test_resources_with_attributes():
157159

158160
def test_css_resources_with_attributes():
159161
"""Test that attributes are passed through in CSS resources with href"""
160-
app = dash.Dash(__name__, serve_locally=False)
162+
app = dash.Dash(__name__)
161163

162164
# Test external CSS with attributes
163165
resources = app._collect_and_register_resources(
164166
[
165167
{
166168
"external_url": "https://example.com/styles.css",
167169
"attributes": {"media": "print"},
170+
"external_only": True,
168171
},
169172
{
170173
"external_url": "https://example.com/theme.css",
171174
"attributes": {"crossorigin": "anonymous"},
175+
"external_only": True,
172176
},
173177
],
174178
url_attr="href",
@@ -182,11 +186,11 @@ def test_css_resources_with_attributes():
182186

183187
def test_resources_without_attributes():
184188
"""Test that resources without attributes still work as strings"""
185-
app = dash.Dash(__name__, serve_locally=False)
189+
app = dash.Dash(__name__)
186190

187191
resources = app._collect_and_register_resources(
188192
[
189-
{"external_url": "https://example.com/script.js"},
193+
{"external_url": "https://example.com/script.js", "external_only": True},
190194
]
191195
)
192196

@@ -230,7 +234,7 @@ def test_local_resources_with_attributes(mocker):
230234

231235
def test_multiple_external_urls_with_attributes():
232236
"""Test that multiple external URLs with attributes work correctly"""
233-
app = dash.Dash(__name__, serve_locally=False)
237+
app = dash.Dash(__name__)
234238

235239
resources = app._collect_and_register_resources(
236240
[
@@ -240,6 +244,7 @@ def test_multiple_external_urls_with_attributes():
240244
"https://example.com/script2.js",
241245
],
242246
"attributes": {"type": "module"},
247+
"external_only": True,
243248
}
244249
]
245250
)

0 commit comments

Comments
 (0)