@@ -0,0 +1,1956 @@
+import testtools%0A%0Aimport mox%0A%0Aimport staccato.xfer.events as xfer_events%0Aimport staccato.xfer.constants as constants%0A%0Aclass TestEventsStateMachine(testtools.TestCase):%0A%0A    def setUp(self):%0A        super(TestEventsStateMachine, self).setUp()%0A        self.mox = mox.Mox()%0A%0A    def tearDown(self):%0A        super(TestEventsStateMachine, self).tearDown()%0A        self.mox.UnsetStubs()%0A%0A%0A    def test_printer(self):%0A        # just make sure it works%0A        xfer_events._print_state_machine()%0A%0A    def test_state_new_to_running(self):%0A        executor = self.mox.CreateMockAnything()%0A        db = self.mox.CreateMockAnything()%0A        xfer_request = self.mox.CreateMockAnything()%0A        xfer_request.state = constants.States.STATE_NEW%0A        xfer_request.id = %22ID%22%0A        my_states = xfer_events.XferStateMachine(executor)%0A        self.mox.StubOutWithMock(my_states, 'state_running_handler')%0A        self.mox.StubOutWithMock(my_states, '_get_current_state')%0A        self.mox.StubOutWithMock(my_states, '_state_changed')%0A%0A        my_states._get_current_state(db=db, xfer_request=xfer_request).AndReturn(constants.States.STATE_NEW)%0A        my_states._state_changed(constants.States.STATE_NEW,%0A                                 constants.Events.EVENT_START,%0A                                 constants.States.STATE_RUNNING,%0A                                 db=db, xfer_request=xfer_request)%0A%0A        # the function pointers and mox make the next stub not work%0A        # my_states.state_running_handler(%0A        #     constants.States.STATE_NEW,%0A        #     constants.Events.EVENT_START,%0A        #     constants.States.STATE_RUNNING,%0A        #     db,%0A        #     xfer_request)%0A        executor.execute(xfer_request.id, my_states)%0A%0A        self.mox.ReplayAll()%0A        my_states.event_occurred(constants.Events.EVENT_START,%0A                                    xfer_request=xfer_request,%0A                                    db=db)%0A        self.mox.VerifyAll()%0A%0A

test for the state machine software