def fileHandler(numor):
    '''
    
    User can send a binary / ascii file or an url for a file location.
    
    To test:
    
    curl -v --noproxy '*' -X POST --data-binary @094460.nxs http://localhost:8080/file/094460

    curl -v --noproxy '*' -X POST --data "`pwd`" http://localhost:8080/file/094460
    
    '''
    
    logger.debug("Receiving file by HTTP POST with numor = %s" % numor)
    
    content = bottle.request.body.read()
    
    v = FileValidator(content)
    message = v.validateFile(numor)
    
    logger.debug(message)
    return message
 def testValidatorText(self):
     content = open(self.textFile)
     v = FileValidator(content.read())
     message = v.validateFile(1234)
     content.close()
     self.assertDictContainsSubset({'success' : 'True','details' : 'The content is: Ascii'}, message)
 def testValidatorURL(self):
     content = self.url
     v = FileValidator(content)
     message = v.validateFile(1234)
     self.assertDictContainsSubset({'success' : 'True','details' : 'The content is: Url'}, message)
 def testValidatorNexus(self):
     content = open(self.nexusFile)
     v = FileValidator(content.read())
     message = v.validateFile(1234)
     content.close()
     self.assertDictContainsSubset({'success' : 'True','details' : 'The content is: NeXus'}, message)