
* test_client_storage: remove race conditions for cookie assignment Poll for default timeout for cookies to appear in the controlled browser. * Remove use of deprecated get_token and get_sid in core Both reflex.app and reflex.state were still using deprecated methods, which were throwing unsolvable warnings for end users. * Remove deprecated router functions from integration tests Mostly removing custom "token" var and replacing with router.session.client_token. Also replacing `get_query_params` and `get_current_page` usage as well. * fix upload tests Cannot pass substate as main app state, since it blocks us from accessing "inherited vars" * state: do NOT reset `router` to default When calling `.reset` to reset state vars, do NOT reset the router data, as that could mess up internal event processing.
32 lines
718 B
Python
32 lines
718 B
Python
"""Common rx.State subclasses for use in tests."""
|
|
import reflex as rx
|
|
|
|
from .mutation import DictMutationTestState, ListMutationTestState, MutableTestState
|
|
from .upload import (
|
|
ChildFileUploadState,
|
|
FileStateBase1,
|
|
FileUploadState,
|
|
GrandChildFileUploadState,
|
|
SubUploadState,
|
|
UploadState,
|
|
)
|
|
|
|
|
|
class GenState(rx.State):
|
|
"""A state with event handlers that generate multiple updates."""
|
|
|
|
value: int
|
|
|
|
def go(self, c: int):
|
|
"""Increment the value c times and update each time.
|
|
|
|
Args:
|
|
c: The number of times to increment.
|
|
|
|
Yields:
|
|
After each increment.
|
|
"""
|
|
for _ in range(c):
|
|
self.value += 1
|
|
yield
|