MCPcopy
hub / github.com/reflex-dev/reflex / test_cloud_banner

Function test_cloud_banner

tests/integration/test_connection_banner.py:285–314  ·  view source on GitHub ↗

Test that the connection banner is displayed when the websocket drops. Args: connection_banner: AppHarness instance. simulate_compile_context: Which context to set for the app.

(
    connection_banner: AppHarness, simulate_compile_context: constants.CompileContext
)

Source from the content-addressed store, hash-verified

283
284
285def test_cloud_banner(
286 connection_banner: AppHarness, simulate_compile_context: constants.CompileContext
287):
288 """Test that the connection banner is displayed when the websocket drops.
289
290 Args:
291 connection_banner: AppHarness instance.
292 simulate_compile_context: Which context to set for the app.
293 """
294 assert connection_banner.app_instance is not None
295 assert connection_banner.backend is not None
296 driver = connection_banner.frontend()
297
298 driver.add_cookie({"name": "backend-enabled", "value": "truly"})
299 driver.refresh()
300 _assert_token(connection_banner, driver)
301 AppHarness.expect(lambda: not has_cloud_banner(driver))
302
303 driver.add_cookie({"name": "backend-enabled", "value": "false"})
304 driver.refresh()
305 if simulate_compile_context == constants.CompileContext.DEPLOY:
306 AppHarness.expect(lambda: has_cloud_banner(driver))
307 else:
308 _assert_token(connection_banner, driver)
309 AppHarness.expect(lambda: not has_cloud_banner(driver))
310
311 driver.delete_cookie("backend-enabled")
312 driver.refresh()
313 _assert_token(connection_banner, driver)
314 AppHarness.expect(lambda: not has_cloud_banner(driver))

Callers

nothing calls this directly

Calls 4

_assert_tokenFunction · 0.85
has_cloud_bannerFunction · 0.85
frontendMethod · 0.80
expectMethod · 0.80

Tested by

no test coverage detected