EOX GitLab Instance

Skip to content
Snippets Groups Projects
Commit b1dc6913 authored by Mussab Abdalla's avatar Mussab Abdalla
Browse files

read thevariables from the .env file

parent 0b9a1d74
No related branches found
No related tags found
No related merge requests found
import psycopg2
import os
database_user = os.environ.get('DB_USER')
database_password = os.environ.get('DB_PW')
host = os.environ.get('DB_HOST')
port = os.environ.get('DB_PORT')
database = os.environ.get('DB_NAME')
print (database)
print(host)
print(database_password)
print(database_user)
print(database)
lines = tuple(open('./env/emg_db.env', 'r'))
for line in lines:
variable_key = line.split("=",1)[0]
variable = line.split("=",1)[1]
if variable_key == "DB_USER" :
database_user = variable
elif variable_key == "DB_PW" :
database_password = variable
elif variable_key == "DB_HOST" :
host = variable
elif variable_key == "DB_PORT" :
port = variable
elif variable_key == "DB_NAME" :
database = variable
def connect_to_db(eo_id):
global db_name, coverage_id
connection= None
......@@ -33,9 +39,9 @@ def connect_to_db(eo_id):
# def test_db_name(name):
# identifier = name.split('/')[4]
# connect_to_db(identifier)
# assert coverage_id == identifier
# assert db_name == database
def test_db_name(name):
identifier = name.split('/')[4]
connect_to_db(identifier)
assert coverage_id == identifier
assert db_name == database
pytest
psycopg2
\ No newline at end of file
psycopg2
python-swiftclient
python-keystoneclient
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment