예제 #1
0
    def test_remove_state_twice_for_existing_state_in_mem(self):

        state_manager = ActorStateManager(self._fake_actor)
        _run(state_manager.set_state('state1', 'value1'))
        removed = _run(state_manager.try_remove_state('state1'))
        self.assertTrue(removed)
        removed = _run(state_manager.try_remove_state('state1'))
        self.assertFalse(removed)
예제 #2
0
    def test_remove_state_for_existing_state(self):

        state_manager = ActorStateManager(self._fake_actor)
        removed = _run(state_manager.try_remove_state('state1'))
        self.assertTrue(removed)

        state = state_manager._state_change_tracker['state1']
        self.assertEqual(StateChangeKind.remove, state.change_kind)
예제 #3
0
    def test_get_state_for_removed_value(self):

        state_manager = ActorStateManager(self._fake_actor)
        removed = _run(state_manager.try_remove_state('state1'))
        self.assertTrue(removed)

        state = state_manager._state_change_tracker['state1']
        self.assertEqual(StateChangeKind.remove, state.change_kind)

        has_value, val = _run(state_manager.try_get_state('state1'))
        self.assertFalse(has_value)
        self.assertIsNone(val)
예제 #4
0
    def test_remove_state_for_non_existing_state(self):

        state_manager = ActorStateManager(self._fake_actor)
        removed = _run(state_manager.try_remove_state('state1'))
        self.assertFalse(removed)