Exemplo n.º 1
0
def parse():
    f = request.files['file']
    if allowed_extensions(f.filename):
        filename = secure_filename(f.filename)
        f.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
        response = Log.process(app.config['UPLOAD_FOLDER'] + "/" + f.filename)
        success = True
    else:
        response = 'Invalid extension'
        success = False

    return formatResponse(response, success)
Exemplo n.º 2
0
 def testInsertLogSuccess(self):
     Dal = Mongo(self.log.collectionName)
     Log = self.log(Dal)
     self.assertEqual(len(str(Log.process('/app/fileToSend/log.txt'))), 24)
Exemplo n.º 3
0
 def testInsertLogFail(self):
     Dal = Mongo(self.log.collectionName)
     Log = self.log(Dal)
     with self.assertRaises(OSError):
         Log.process('/app/fileToSend/arquivoinexistente.txt')