Esempio n. 1
0
 def testValidateDateFormat(self):
     schema = loadSchemaFor("ReservationRequest")
     request = reservationRequest()
     request['availabilityReportDate'] = "xyz"
     try:
         validateWithChecker(request, schema)
         self.fail()
     except ValidationError as e:
         print e.message
         pass
    def testPostReservations(self):
        data = reservationRequest()
        requestHandler = RequestHandler()
        response = requestHandler.postReservations(data)

        self.assertEqual(201, response.status)
        self.assertEqual('Created', response.reason)

        responseSchema = loadReservationResponseSchema()
        validateWithChecker(response.body, responseSchema)
Esempio n. 3
0
    def testPostReservations(self):
        data = reservationRequest()
        requestHandler = RequestHandler()
        response = requestHandler.postReservations(data)

        self.assertEqual(201, response.status)
        self.assertEqual('Created', response.reason)

        responseSchema = loadReservationResponseSchema()
        validateWithChecker(response.body, responseSchema)
 def testValidateDateFormat(self):
     schema = loadSchemaFor("ReservationRequest")
     request = reservationRequest()
     request['availabilityReportDate'] = "xyz"
     try:
         validateWithChecker(request, schema)
         self.fail()
     except ValidationError as e:
         print e.message
         pass
    def testReservationWorkflow(self):
# - Set Antenna Availabilty: this is testing step only
        from datetime import datetime as dt
        from TimeUtils import datetimeAsIso8601

        data = antennaAvailability()
        data['generationDate'] = datetimeAsIso8601(dt.now())
        requestHandler = RequestHandler()
        response = requestHandler.postAntennaAvailability(data)
        self.assertEqual(201, response.status)

        startDate =  '2015-10-16T10:00:00Z'
        endDate =  '2015-10-17T10:00:00Z'

        response = requestHandler.getAntennaAvailability(startDate, endDate)

        self.assertEqual(200, response.status)
        self.assertEqual('OK', response.reason)

# - Get Antenna Availabilty: this begins every reservation cycle
        startDate =  '2015-10-16T10:00:00Z'
        endDate =  '2015-10-17T10:00:00Z'

        response = requestHandler.getAntennaAvailability(startDate, endDate)
        # TODO capture generation date from availability report

        self.assertEqual(200, response.status)
        self.assertEqual('OK', response.reason)
        responseSchema = loadAntennaAvailabilitySchema()
        validateWithChecker(response.body, responseSchema)

# - Update (POST) reservations.
        data = reservationRequest()
        # TODO consider: do we inject the date form our antenna avail report at this point? Or let service do that
        # TODO update generation date in reservation request before posting
        requestHandler = RequestHandler()
        response = requestHandler.postReservations(data)

        self.assertEqual(201, response.status)
        self.assertEqual('Created', response.reason)
        # TODO assert expected generation date in response

        responseSchema = loadReservationResponseSchema()
        validateWithChecker(response.body, responseSchema)
Esempio n. 6
0
    def testReservationWorkflow(self):
        # - Set Antenna Availabilty: this is testing step only
        from datetime import datetime as dt
        from TimeUtils import datetimeAsIso8601

        data = antennaAvailability()
        data['generationDate'] = datetimeAsIso8601(dt.now())
        requestHandler = RequestHandler()
        response = requestHandler.postAntennaAvailability(data)
        self.assertEqual(201, response.status)

        startDate = '2015-10-16T10:00:00Z'
        endDate = '2015-10-17T10:00:00Z'

        response = requestHandler.getAntennaAvailability(startDate, endDate)

        self.assertEqual(200, response.status)
        self.assertEqual('OK', response.reason)

        # - Get Antenna Availabilty: this begins every reservation cycle
        startDate = '2015-10-16T10:00:00Z'
        endDate = '2015-10-17T10:00:00Z'

        response = requestHandler.getAntennaAvailability(startDate, endDate)
        # TODO capture generation date from availability report

        self.assertEqual(200, response.status)
        self.assertEqual('OK', response.reason)
        responseSchema = loadAntennaAvailabilitySchema()
        validateWithChecker(response.body, responseSchema)

        # - Update (POST) reservations.
        data = reservationRequest()
        # TODO consider: do we inject the date form our antenna avail report at this point? Or let service do that
        # TODO update generation date in reservation request before posting
        requestHandler = RequestHandler()
        response = requestHandler.postReservations(data)

        self.assertEqual(201, response.status)
        self.assertEqual('Created', response.reason)
        # TODO assert expected generation date in response

        responseSchema = loadReservationResponseSchema()
        validateWithChecker(response.body, responseSchema)
Esempio n. 7
0
def reservationResponse():
    requestJson = reservationRequest()
    (deniedCount, response) = processReservation(requestJson,
                                                 antennaAvailability())
    return response
def reservationResponse():
    requestJson = reservationRequest()
    (deniedCount, response) = processReservation(requestJson, antennaAvailability())
    return response
Esempio n. 9
0
 def reservationRequestWithErrors(self):
     request = reservationRequest()
     request['availabilityReportDate'] = "bogus-date"
     return request
Esempio n. 10
0
 def testValidateReservationRequest(self):
     schema = loadSchemaFor("ReservationRequest")
     request = reservationRequest()
     validateWithChecker(request, schema)
 def reservationRequestWithErrors(self):
     request = reservationRequest()
     request['availabilityReportDate'] = "bogus-date"
     return request
 def testValidateReservationRequest(self):
     schema = loadSchemaFor("ReservationRequest")
     request = reservationRequest()
     validateWithChecker(request, schema)