예제 #1
0
 def test_add_static_server_and_get_static_files_ok(self):
     '''CONFIG | Configura ruta raíz y carpeta con contenido estático'''
     #arrange
     _app = AppFactory.create_app(_api, db, self.dbLocation)
     _app.testing = True
     self.imgDir = 'imgDir'
     self.imgRelPath = self.imgDir + '/img.png'
     os.mkdir(self.defaultDir + '/' + self.imgDir)
     os.mknod(self.defaultDir + '/' + self.imgRelPath)
     os.mknod(self.defaultDir + '/' + self.defaultFile)
     with open(self.defaultDir + '/' + self.defaultFile, 'a') as f:
         f.write('Hola Sqrum')
     
     #act
     AppFactory.add_static_server(_app, self.defaultDir, self.defaultFile)
     
     #assert
     with _app.test_client() as c:
         res = c.get('/')
         assert res.status_code == 200
         assert 'Hola Sqrum' in res.data
         assert c.get(self.imgRelPath).status_code == 200
예제 #2
0
# -*- coding: utf-8 -*-
import os
from common import _app, _api, db
from app_factory import AppFactory
import data

if __name__ == '__main__':
     port = int(os.getenv('PORT', 8080))
     host = os.getenv('IP', '0.0.0.0')
     _app = AppFactory.create_app(_api, db, "sqrum.db")
     AppFactory.add_static_server(_app,'front', 'index.html')
     AppFactory.add_test_data(db, data.roles)
     AppFactory.add_test_data(db, data.stories)
     AppFactory.add_test_data(db, data.desarrolladores)
     AppFactory.add_test_data(db, data.iteraciones)
     _app.run(port=port, host=host, debug=True)