Exemple #1
0
 def test100_962ShouldReturnValuesWithErrorWhenTemperatureOutOfLowerBound(
         self):
     self.setParm('op', 'adjust')
     self.setParm('observation', '33d12.5')
     self.setParm('temperature', '-30')
     result = nav.dispatch(self.inputDictionary)
     self.assertTrue(result.has_key("error"), True)
 def test900_040MissingAssumedLat(self):       
     self.setParm('op','correct')
     self.setParm('lat','89d20.1')
     self.setParm('long','154d5.4')
     self.setParm('altitude','37d15.6')
     actualResult = dispatch.dispatch(self.inputDictionary)
     self.assertEquals(actualResult['error'], 'mandatory information is missing')
 def test900_031AltitudeNotValid(self):       
     self.setParm('op','correct')
     self.setParm('lat','89d20.1')
     self.setParm('long','154d5.4')
     self.setParm('altitude','0d0.0')
     actualResult = dispatch.dispatch(self.inputDictionary)
     self.assertEquals(actualResult['error'], 'altitude is not valid')    
 def test900_035InvalidDate(self):       
     self.setParm('op','predict')
     self.setParm('body','Betelgeuse')
     self.setParm('date','2016-01-17')
     self.setParm('time','03:15:99')
     actualResult = dispatch.dispatch(self.inputDictionary)
     self.assertEquals(actualResult['error'], 'invalid date')
 def test900_040DateAndTimeMustHaveTwoDigits(self):
     self.setParm('op','predict')       
     self.setParm('body','Betelgeuse')
     self.setParm('date','2016-01-17')
     self.setParm('time','3:15:42')        
     actualResult = dispatch.dispatch(self.inputDictionary)
     self.assertEquals(actualResult['error'], 'date and time must have two digits')
Exemple #6
0
 def test100_982ShouldReturnValuesWithErrorWhenPressureOutOfLowerBound(
         self):
     self.setParm('op', 'adjust')
     self.setParm('observation', '45d12')
     self.setParm('pressure', '99')
     result = nav.dispatch(self.inputDictionary)
     self.assertTrue(result.has_key("error"), True)
Exemple #7
0
 def test900_060ShouldHaveAtleastOneDigitRightDecimal(self):
     self.setParm('op', 'adjust')
     self.setParm('observation', '42d0')
     actualResult = dispatch.dispatch(self.inputDictionary)
     self.assertEquals(
         actualResult['error'],
         'must have at least one digit to the right of the decimal point')
Exemple #8
0
 def test100_960ShouldReturnValuesWithErrorWhenTemperatureNotInteger(self):
     self.setParm('op', 'adjust')
     self.setParm('observation', '33d12.5')
     self.setParm('height', '0')
     self.setParm('temperature', '140')
     result = nav.dispatch(self.inputDictionary)
     self.assertTrue(result.has_key("error"), True)
Exemple #9
0
 def test100_010ShouldReturnCorrectAltitude(self):
     self.setParm('op', 'adjust')
     self.setParm('observation', '13d51.6')
     self.setParm('height', '33')
     self.setParm('temperature', '72')
     self.setParm('pressure', '1010')
     self.setParm('horizon', 'natural')
     result = nav.dispatch(self.inputDictionary)
     self.assertTrue(result['altitude'] == '13d42.3', True)
def server():
    try:
        parm = {}
        for key in request.args:
            parm[key] = str(request.args[key])
        result = nav.dispatch(parm)
        return str(result)
    except Exception as e:
        return e
 def test900_051ReturnErrorIfMinutesIsNotNumerical(self):
     self.setParm('op','correct')
     self.setParm('lat','89dabc')
     self.setParm('long','0154d05.4')
     self.setParm('altitude','037d015.6')
     self.setParm('assumedLat','033d059.7')
     self.setParm('assumedLong','074d035.3')
     actualResult = dispatch.dispatch(self.inputDictionary)
     self.assertEquals(actualResult['error'], 'lat is not valid')    
 def test900_041AssumedLongNotValid(self):       
     self.setParm('op','correct')
     self.setParm('lat','89d20.1')
     self.setParm('long','154d5.4')
     self.setParm('altitude','37d15.6')
     self.setParm('assumedLat','33d59.7')
     self.setParm('assumedLong','-0d30.3')
     actualResult = dispatch.dispatch(self.inputDictionary)
     self.assertEquals(actualResult['error'], 'assumedLong is not valid')    
 def test100_092ShouldReturnDesiredOutputThroughDispatch(self): 
     self.setParm('op','correct')
     self.setParm('lat','16d32.3')
     self.setParm('long','95d41.6')
     self.setParm('altitude','13d42.3')
     self.setParm('assumedLat','-53d38.4')
     self.setParm('assumedLong','350d35.3')
     actualResult = dispatch.dispatch(self.inputDictionary)
     self.assertEquals(actualResult['correctedDistance'], '1488')
     self.assertEquals(actualResult['correctedAzimuth'], '77d6.9')    
 def test100_090ShouldReturnDesiredOutputThroughDispatch(self): 
     self.setParm('op','correct')
     self.setParm('lat','89d20.1')
     self.setParm('long','154d5.4')
     self.setParm('altitude','37d15.6')
     self.setParm('assumedLat','33d59.7')
     self.setParm('assumedLong','74d35.3')
     actualResult = dispatch.dispatch(self.inputDictionary)
     self.assertEquals(actualResult['correctedDistance'], '222')
     self.assertEquals(actualResult['correctedAzimuth'], '0d36.0')
 def test100_091ShouldReturnDesiredOutputThroughDispatchWithLeadingZero(self): 
     self.setParm('op','correct')
     self.setParm('lat','089d020.1')
     self.setParm('long','0154d05.4')
     self.setParm('altitude','037d015.6')
     self.setParm('assumedLat','033d059.7')
     self.setParm('assumedLong','074d035.3')
     actualResult = dispatch.dispatch(self.inputDictionary)
     self.assertEquals(actualResult['correctedDistance'], '222')
     self.assertEquals(actualResult['correctedAzimuth'], '0d36.0')  
Exemple #16
0
 def test800_020StarNotInCatalog(self):
     self.setParm('op', 'predict')
     self.setParm('body', 'unknown')
     self.setParm('date', '2016-01-17')
     self.setParm('time', '03:15:42')
     result = nav.dispatch(self.inputDictionary)
     self.assertEquals(result['op'], 'predict')
     self.assertEquals(result['body'], 'unknown')
     self.assertEquals(result['date'], '2016-01-17')
     self.assertEquals(result['time'], '03:15:42')
     self.assertEquals(result['error'], 'star not in catalog')
Exemple #17
0
 def test200_015ShouldReturnCorrectResult(self):
     self.setParm('op', 'predict')
     self.setParm('body', 'Betelgeuse')
     self.setParm('date', '2016-01-17')
     self.setParm('time', '03:15:42')
     result = nav.dispatch(self.inputDictionary)
     self.assertEquals(result['op'], 'predict')
     self.assertEquals(result['body'], 'Betelgeuse')
     self.assertEquals(result['date'], '2016-01-17')
     self.assertEquals(result['time'], '03:15:42')
     self.assertEquals(result['long'], '75d53.6')
     self.assertEquals(result['lat'], '7d24.3')
Exemple #18
0
 def test200_010ShouldReturnCorrectResult(self):
     self.setParm('op', 'predict')
     self.setParm('body', 'Aldebaran')
     self.setParm('date', '2016-01-17')
     self.setParm('time', '03:15:42')
     result = nav.dispatch(self.inputDictionary)
     self.assertEquals(result['op'], 'predict')
     self.assertEquals(result['body'], 'Aldebaran')
     self.assertEquals(result['date'], '2016-01-17')
     self.assertEquals(result['time'], '03:15:42')
     self.assertEquals(result['long'], '95d41.6')
     self.assertEquals(result['lat'], '16d32.3')
 def test900_060ReturnErrorIfDegreeIsMissing(self):
     self.setParm('op','correct')
     self.setParm('lat','d32.3')
     self.setParm('long','95d41.6')
     self.setParm('altitude','13d42.3')
     self.setParm('assumedLat','-53d38.4')
     self.setParm('assumedLong','350d35.3')
     actualResult = dispatch.dispatch(self.inputDictionary)
     self.assertEquals(actualResult['error'], 'lat is not valid')     
     
     
     
     
     
     
     
     
 def test900_010MissingBody(self):       
     self.setParm('op','predict')
     actualResult = dispatch.dispatch(self.inputDictionary)
     self.assertEquals(actualResult['error'], 'body is missing') 
Exemple #21
0
 def test100_990ShouldReturnValuesWithErrorWhenHorizonInvalid(self):
     self.setParm('op', 'adjust')
     self.setParm('observation', '45d12')
     self.setParm('horizon', 'invalid')
     result = nav.dispatch(self.inputDictionary)
     self.assertTrue(result.has_key("error"), True)
 def test900_023MinutesNotInCorrectForm(self):       
     self.setParm('op','correct')
     self.setParm('lat','89d20.1')
     self.setParm('long','154d5')
     actualResult = dispatch.dispatch(self.inputDictionary)
     self.assertEquals(actualResult['error'], 'long is not valid')
 def test900_021LongIsNotValid(self):       
     self.setParm('op','correct')
     self.setParm('lat','89d20.1')
     self.setParm('long','1545.4')
     actualResult = dispatch.dispatch(self.inputDictionary)
     self.assertEquals(actualResult['error'], 'long is not valid')    
 def test900_020MissingLong(self):       
     self.setParm('op','correct')
     self.setParm('lat','89d20.1')
     actualResult = dispatch.dispatch(self.inputDictionary)
     self.assertEquals(actualResult['error'], 'mandatory information is missing')
 def test900_011LatIsNotValid(self):       
     self.setParm('op','correct')
     self.setParm('lat','8920.1')
     actualResult = dispatch.dispatch(self.inputDictionary)
     self.assertEquals(actualResult['error'], 'lat is not valid')
 def test900_020StarNotInData(self):       
     self.setParm('op','predict')
     self.setParm('body','unknown')
     actualResult = dispatch.dispatch(self.inputDictionary)
     self.assertEquals(actualResult['error'], 'star not in catalog')
 def test900_024MinutesOutOfBound(self):       
     self.setParm('op','correct')
     self.setParm('lat','89d20.1')
     self.setParm('long','154d60.0')
     actualResult = dispatch.dispatch(self.inputDictionary)
     self.assertEquals(actualResult['error'], 'long is not valid')    
Exemple #28
0
 def test800_010MissingBody(self):
     self.setParm('op', 'predict')
     result = nav.dispatch(self.inputDictionary)
     self.assertEquals(result['error'], 'body is missing')
 def test900_013LatOutOfLowerBound(self):       
     self.setParm('op','correct')
     self.setParm('lat','-90d0.0')
     actualResult = dispatch.dispatch(self.inputDictionary)
     self.assertEquals(actualResult['error'], 'lat is not valid')
Exemple #30
0
 def test900_050NoOpSpecifiedTest(self):
     self.setParm('op', '')
     self.setParm('observation', '42d0.0')
     actualResult = dispatch.dispatch(self.inputDictionary)
     self.assertEquals(actualResult['error'], 'no op  is specified')