'Tests the ability to delay a CallState invocation.'

def testDelayedCallState(self):

    with test_lib.FakeTime(10000):
        client_mock = ClientMock()
        client_mock = flow_test_lib.MockClient(self.client_id, client_mock, token=self.token)
        worker_mock = worker_test_lib.MockWorker(check_flow_errors=True, token=self.token)
        flow.GRRFlow.StartFlow(client_id=self.client_id, flow_name='DelayedCallStateFlow', token=self.token)
        self.Work(client_mock, worker_mock)
        self.assertEqual(DelayedCallStateFlow.flow_ran, 1)
    with test_lib.FakeTime(10050):
        self.Work(client_mock, worker_mock)
        self.assertEqual(DelayedCallStateFlow.flow_ran, 1)
    with test_lib.FakeTime(10100):
        self.Work(client_mock, worker_mock)
        self.assertEqual(DelayedCallStateFlow.flow_ran, 2)
