userver: pytest_userver.client._StateManager Class Reference
Loading...
Searching...
No Matches
pytest_userver.client._StateManager Class Reference

Detailed Description

Used for computing the requests that we need to automatically align the service state with the test fixtures state.

Definition at line 1318 of file client.py.

Public Member Functions

 __init__ (self, *, mocked_time, testpoint, testpoint_control, caches.InvalidationState invalidation_state, typing.Optional[caches.CacheControl] cache_control)
 
 updating_state (self, typing.Dict[str, typing.Any] body)
 Whenever tests_control handler is invoked (by the client itself during prepare or manually by the user), we need to synchronize _state with the (supposed) service state.
 
typing.Dict[str, typing.Any] get_pending_update (self)
 Compose the body of the tests_control request required to completely synchronize the service state with the state of test fixtures.
 
typing.ContextManager[typing.Dict] cache_control_update (self)
 

Protected Member Functions

None _update_state (self, typing.Dict[str, typing.Any] body)
 
 _apply_new_state (self)
 Apply new state to related components.
 
typing.Optional[str] _get_desired_now (self)
 

Static Protected Member Functions

None _apply_cache_control_actions (typing.Dict invalidate_caches, typing.List[typing.Tuple[str, caches.CacheControlAction]] actions)
 

Protected Attributes

 _state
 
 _mocked_time = mocked_time
 
 _testpoint = testpoint
 
 _testpoint_control = testpoint_control
 
 _invalidation_state = invalidation_state
 
 _cache_control = cache_control
 

Constructor & Destructor Documentation

◆ __init__()

pytest_userver.client._StateManager.__init__ ( self,
* ,
mocked_time,
testpoint,
testpoint_control,
caches.InvalidationState invalidation_state,
typing.Optional[caches.CacheControl] cache_control )

Definition at line 1324 of file client.py.

Member Function Documentation

◆ _apply_cache_control_actions()

None pytest_userver.client._StateManager._apply_cache_control_actions ( typing.Dict invalidate_caches,
typing.List[typing.Tuple[str, caches.CacheControlAction]] actions )
staticprotected

Definition at line 1398 of file client.py.

◆ _apply_new_state()

pytest_userver.client._StateManager._apply_new_state ( self)
protected

Apply new state to related components.

Definition at line 1441 of file client.py.

◆ _get_desired_now()

typing.Optional[str] pytest_userver.client._StateManager._get_desired_now ( self)
protected

Definition at line 1446 of file client.py.

◆ _update_state()

None pytest_userver.client._StateManager._update_state ( self,
typing.Dict[str, typing.Any] body )
protected

Definition at line 1417 of file client.py.

◆ cache_control_update()

typing.ContextManager[typing.Dict] pytest_userver.client._StateManager.cache_control_update ( self)

Definition at line 1385 of file client.py.

◆ get_pending_update()

typing.Dict[str, typing.Any] pytest_userver.client._StateManager.get_pending_update ( self)

Compose the body of the tests_control request required to completely synchronize the service state with the state of test fixtures.

Definition at line 1360 of file client.py.

◆ updating_state()

pytest_userver.client._StateManager.updating_state ( self,
typing.Dict[str, typing.Any] body )

Whenever tests_control handler is invoked (by the client itself during prepare or manually by the user), we need to synchronize _state with the (supposed) service state.

The state update is decoded from the request body.

Definition at line 1343 of file client.py.

Member Data Documentation

◆ _cache_control

pytest_userver.client._StateManager._cache_control = cache_control
protected

Definition at line 1340 of file client.py.

◆ _invalidation_state

pytest_userver.client._StateManager._invalidation_state = invalidation_state
protected

Definition at line 1339 of file client.py.

◆ _mocked_time

pytest_userver.client._StateManager._mocked_time = mocked_time
protected

Definition at line 1336 of file client.py.

◆ _state

pytest_userver.client._StateManager._state
protected
Initial value:
= _State(
invalidation_state=copy.deepcopy(invalidation_state),
)

Definition at line 1333 of file client.py.

◆ _testpoint

pytest_userver.client._StateManager._testpoint = testpoint
protected

Definition at line 1337 of file client.py.

◆ _testpoint_control

pytest_userver.client._StateManager._testpoint_control = testpoint_control
protected

Definition at line 1338 of file client.py.


The documentation for this class was generated from the following file: