def setUpClass(cls):
     cls.url = "http://{host}:{port}/chrompack".format(
         host=defines.BIOPROCESS_HOST, port=defines.BIOPROCESS_PORT)
     cls.db_connection = DbConnection(defines.MONGO_HOST,
                                      defines.MONGO_USER,
                                      defines.MONGO_PASS, defines.MONGO_DB,
                                      defines.MONGO_PORT)
     cls.collection = 'chrompack'
     cls.user_test = 'test_chrompack_one_sample'
Exemple #2
0
 def get_valid_connection(self):
     return DbConnection(defines.MONGO_HOST, defines.MONGO_USER,
                         defines.MONGO_PASS, defines.MONGO_DB,
                         defines.MONGO_PORT)
Exemple #3
0
 def test_port_type_wrong(self):
     with self.assertRaisesRegex(TypeError,
                                 "port must be a int, not <class 'str'>"):
         DbConnection("hostname", "username", "password", "database",
                      "port")
Exemple #4
0
 def test_database_type_wrong(self):
     with self.assertRaisesRegex(
             TypeError, "database must be a string, not <class 'int'>"):
         DbConnection("hostname", "username", "password", 123, 123)
Exemple #5
0
 def get_instance(self):
     return DbConnection(defines.MONGO_HOST, defines.MONGO_USER,
                         defines.MONGO_PASS, defines.MONGO_DB,
                         defines.MONGO_PORT)
Exemple #6
0

def initialize_directory_data():

    if not os.path.exists(defines.DATA_PATH):
        os.mkdir(defines.DATA_PATH)

    if not os.path.exists(defines.DATA_CHROMPACK):
        os.mkdir(defines.DATA_CHROMPACK)

    if not os.path.exists(defines.DATA_SAMPLE):
        os.mkdir(defines.DATA_SAMPLE)


db_connection = DbConnection(defines.MONGO_HOST, defines.MONGO_USER,
                             defines.MONGO_PASS, defines.MONGO_DB,
                             defines.MONGO_PORT)

params_api = {'upload_folder': 'data', 'db_connection': db_connection}

app = Flask(__name__)

initialize_directory_data()

CORS(app)

api = Api(app)
app.config["JSON_SORT_KEYS"] = False
app.config['JWT_SECRET_KEY'] = defines.SECRET_KEY

JWTManager(app)