def test(plan_trip_request):
    logging.info("Starting test")
    logging.info("Opening connection")
    ws = create_connection("ws://localhost/planner")

    data = json.dumps({"PlanTripRequestType": marshal(plan_trip_request, plan_trip_request_type)})
    logging.info("Send: %s" % data)
    ws.send(data)

    msg = receive_msg(ws)
    validate(msg["PlanTripResponse"], formats.plan_trip_response_format)

    msg = receive_msg(ws)
    validate(msg["StartingSearch"], formats.starting_search_format)

    while True:
        msg = receive_msg(ws)
        if "PlanTripExistenceNotificationResponseType" in msg:
            validate(msg["PlanTripExistenceNotificationResponseType"],
                     formats.plan_trip_existence_notification_format)
        elif "PlanTripNotificationResponseType" in msg:
            validate(msg["PlanTripNotificationResponseType"],
                     formats.plan_trip_notification_response_format)
        elif "EndingSearch" in msg:
            validate(msg["EndingSearch"], formats.ending_search_format)
            ws.close()
            break
        else:
            raise Exception("FAIL: Unexpected message: %s" % msg)

    logging.info("End of test: success")
def _marshal_SummedUpTripType(self):
    return {"SummedUpTripType": marshal(self, summed_up_trip_type)}
def _marshal_SummedUpItinerariesRequestType(self):
    return marshal(self, summed_up_itineraries_request_type)
def _marshal_StartingSearch(self):
    return {"StartingSearch": marshal(self, starting_search_type)}
 def _marshal_response(self):
     return {'ItineraryResponse': marshal(self._resp, itinerary_response_type)}
 def _marshal_response(self):
     return {'CapabilitiesResponse': marshal(self._resp, capabilities_response_type)}
 def _marshal_response(self):
     return {
         'ItineraryResponse': marshal(self._resp, itinerary_response_type)
     }
 def _marshal_response(self):
     return {
         'CapabilitiesResponse': marshal(self._resp,
                                         capabilities_response_type)
     }
def _marshal_PlanTripResponse(self):
    return {"PlanTripResponse": marshal(self, plan_trip_response_type)}
Esempio n. 10
0
def _marshal_PlanTripNotificationResponseType(self):
    return {"PlanTripNotificationResponseType": marshal(self, plan_trip_notification_response_type)}
Esempio n. 11
0
def _marshal_SummedUpTripType(self):
    return {"SummedUpTripType": marshal(self, summed_up_trip_type)}
Esempio n. 12
0
def _marshal_SummedUpItinerariesRequestType(self):
    return marshal(self, summed_up_itineraries_request_type)
Esempio n. 13
0
def _marshal_ItineraryRequestType(self):
    return marshal(self, itinerary_request_type)
Esempio n. 14
0
 def marshal(self):
     return {"PlanTripCancellationResponse": marshal(self, plan_trip_cancellation_response_type)}
Esempio n. 15
0
def _marshal_PlanTripNotificationResponseType(self):
    return {
        "PlanTripNotificationResponseType":
        marshal(self, plan_trip_notification_response_type)
    }
Esempio n. 16
0
def _marshal_PlanTripResponse(self):
    return {"PlanTripResponse": marshal(self, plan_trip_response_type)}
Esempio n. 17
0
def _marshal_EndingSearch(self):
    return {"EndingSearch": marshal(self, ending_search_type)}
Esempio n. 18
0
 def _marshal_response(self):
     return {'StopsResponse': marshal(self._resp, stops_response_type)}
Esempio n. 19
0
def _marshal_StartingSearch(self):
    return {"StartingSearch": marshal(self, starting_search_type)}
Esempio n. 20
0
 def _marshal_response(self):
     return {
         'SummedUpItinerariesResponse':
         marshal(self._resp, summed_up_itineraries_response_type)
     }
Esempio n. 21
0
 def marshal(self):
     return {
         "PlanTripCancellationResponse":
         marshal(self, plan_trip_cancellation_response_type)
     }
Esempio n. 22
0
 def _marshal_response(self):
     return {'StopsResponse': marshal(self._resp, stops_response_type)}
Esempio n. 23
0
def _marshal_ItineraryRequestType(self):
    return marshal(self, itinerary_request_type)
Esempio n. 24
0
 def _marshal_response(self):
     return {'SummedUpItinerariesResponse': marshal(self._resp, summed_up_itineraries_response_type)}
Esempio n. 25
0
def _marshal_EndingSearch(self):
    return {"EndingSearch": marshal(self, ending_search_type)}