def test900_070ShouldReturnErrorWhenDInCorrectionsIsMissing(self):
     self.setParm('op','locate')
     self.setParm('assumedLat','50d0.0')
     self.setParm('assumedLong','350d35.3') 
     self.setParm('corrections','[[100,1d0.0], [100, 500.0]]')        
     actualResult = nav.locate(self.inputDictionary)
     self.assertEquals(actualResult['error'], 'correction is not valid')    
 def test900_030ShouldReturnErrorWhenElementInCorrectionsIsNotaList(self):
     self.setParm('op','locate')
     self.setParm('assumedLat','50d0.0')
     self.setParm('assumedLong','350d35.3') 
     self.setParm('corrections','[(100,1d0.0)]')        
     actualResult = nav.locate(self.inputDictionary)
     self.assertEquals(actualResult['error'], 'correction is not valid')
 def test900_010ShouldReturnErrorWhenassumedLatIsNotValid(self):
     self.setParm('op','locate')
     self.setParm('assumedLat','90d0.0')
     self.setParm('assumedLong','350d35.3') 
     self.setParm('corrections','[[100,1d0.0]]')        
     actualResult = nav.locate(self.inputDictionary)
     self.assertEquals(actualResult['error'], 'assumedLat is not valid')     
Exemple #4
0
def dispatch(values=None):

    #Validate param
    if (values == None):
        return {'error': 'parameter is missing'}
    if (not (isinstance(values, dict))):
        return {'error': 'parameter is not a dictionary'}
    if (not ('op' in values)):
        values['error'] = 'no op  is specified'
        return values

    #Perform designated function
    if (values['op'] == 'adjust'):
        result = adjust.adjust(values)
        return result
    elif (values['op'] == 'predict'):
        result = predict.predict(values)
        return result
    elif (values['op'] == 'correct'):
        result = correct.correct(values)
        return result
    elif (values['op'] == 'locate'):
        result = locate.locate(values)
        return result
    else:
        values['error'] = 'op is not a legal operation'
        return values
 def test100_060ShouldReturnCorrectResult(self):
     self.setParm('op','locate')
     self.setParm('assumedLat','-53d38.4')
     self.setParm('assumedLong','350d35.3') 
     self.setParm('corrections','[[100,1d0.0]]') 
     expectedResult = {'assumedLat': '-53d38.4', 
                       'assumedLong': '350d35.3', 
                       'corrections': '[[100,1d0.0]]',  
                       'presentLat': '-51d58.4',
                       'presentLong': '350d37.0',
                       'percision': '0',
                       'accuracy': 'NA',
                       'op': 'locate'}        
     actualResult = nav.locate(self.inputDictionary)
     self.assertEquals(actualResult, expectedResult)