def teardown(self): # Logout self.client.send_message(logout_message(self.client)) message = self.server.wait_for_message(title='waiting for logout') assert_is_not_none(message) assert_tag(message, [(35, FIX.LOGOUT)]) self.server.send_message(logout_message(self.server)) self.server.start_heartbeat(False) message = self.client.wait_for_message('waiting for logout ack') self.client.start_heartbeat(False) assert_is_not_none(message) assert_tag(message, [(35, FIX.LOGOUT)])
def run(self): """ This test is a demonstration of logon and heartbeat/TestRequest processing. Usually the logon process should be done from setup(). """ client = self._clients['client-9940']['node'] client.protocol.heartbeat = 5 # We only have a single server connection server = self._servers['server-9940']['factory'].servers[0] server.protocol.heartbeat = 5 # client -> server client.send_message(logon_message(client)) # server <- client message = server.wait_for_message(title='waiting for logon') assert_is_not_none(message) assert_tag(message, [(35, FIX.LOGON)]) # server -> client server.send_message(logon_message(server)) server.start_heartbeat(True) # client <- server message = client.wait_for_message(title='waiting for logon ack') client.start_heartbeat(True) assert_is_not_none(message) assert_tag(message, [(35, FIX.LOGON)]) # Logout client.send_message(logout_message(client)) message = server.wait_for_message(title='waiting for logout') assert_is_not_none(message) assert_tag(message, [(35, FIX.LOGOUT)]) server.send_message(logout_message(server)) server.start_heartbeat(False) message = client.wait_for_message('waiting for logout ack') client.start_heartbeat(False) assert_is_not_none(message) assert_tag(message, [(35, FIX.LOGOUT)])