def test_seen_request_id(self):
     # If a message has a request ID, that has been seen before, it was
     # sent from the server to the client.
     self.assertEqual('to client',
                      infer_direction({'request_id': 1}, set([1])))
 def test_new_request_id(self):
     # If a message has a request ID, that has not been seen yet, it was
     # sent from the client to the server.
     self.assertEqual('to server', infer_direction({'request_id': 1},
                                                   set()))
 def test_no_request_id(self):
     # If a message has no request ID, then it was sent from the server to
     # the client.
     self.assertEqual('to client', infer_direction({}, set()))
 def test_seen_request_id(self):
     # If a message has a request ID, that has been seen before, it was
     # sent from the server to the client.
     self.assertEqual(
         'to client',
         infer_direction({'request_id': 1}, set([1])))
 def test_new_request_id(self):
     # If a message has a request ID, that has not been seen yet, it was
     # sent from the client to the server.
     self.assertEqual(
         'to server',
         infer_direction({'request_id': 1}, set()))
 def test_no_request_id(self):
     # If a message has no request ID, then it was sent from the server to
     # the client.
     self.assertEqual('to client', infer_direction({}, set()))