def getVariant(self, compoundId): if compoundId.referenceName in self._chromFileMap: varFileName = self._chromFileMap[compoundId.referenceName] else: raise exceptions.ObjectNotFoundException(compoundId) start = int(compoundId.start) referenceName, startPosition, endPosition = \ self.sanitizeVariantFileFetch( compoundId.referenceName, start, start + 1) cursor = self.getFileHandle(varFileName).fetch( referenceName, startPosition, endPosition) for record in cursor: variant = self.convertVariant(record, self._callSetIds) if (record.start == start and compoundId.md5 == self.hashVariant(variant)): return variant elif record.start > start: raise exceptions.ObjectNotFoundException() raise exceptions.ObjectNotFoundException(compoundId)
def testObjectNotFoundException(self): exception = exceptions.ObjectNotFoundException() response = frontend.handleException(exception) self.assertEquals(response.status_code, 404)