diff options
author | Navan Chauhan <navanchauhan@gmail.com> | 2020-09-10 13:06:12 +0530 |
---|---|---|
committer | Navan Chauhan <navanchauhan@gmail.com> | 2020-09-10 13:06:12 +0530 |
commit | 803fd48cf383636585877a4d93652e4f8995a39f (patch) | |
tree | 1be5bce5f40b66c31f43feb3bec4fffa34c9366a /tests/backendTest.py | |
parent | f5de8ddbfc69e0e958310f90d899c878c550ecd2 (diff) |
removing hardcoded values
testing updated github workflow
Diffstat (limited to 'tests/backendTest.py')
-rw-r--r-- | tests/backendTest.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/tests/backendTest.py b/tests/backendTest.py index d172033..0965e0a 100644 --- a/tests/backendTest.py +++ b/tests/backendTest.py @@ -1,6 +1,15 @@ import mysql.connector as con -mycon = con.connect(host="navanspi.duckdns.org",user="curieweb",password="curie-web-russian-54",port=3306,database="curie") +import configparser +config = configparser.ConfigParser() +config.read('config.ini') + +try: + config['DATABASE'] +except KeyError: + config.read("../config.ini") + +mycon = con.connect(host=config['DATABASE']['HOST'],user=config['DATABASE']['USER'],password=config['DATABASE']['PASSWORD'],port=config['DATABASE']['PORT'],database=config['DATABASE']['NAME']) mycursor = mycon.cursor() # If we are running the CI on an actual server, try using the 6LU7 Mpro and Geraniin Job ID because Eucalyptol fails @@ -16,7 +25,7 @@ def email(compressedFile): from email.mime.base import MIMEBase from email import encoders - fromaddr = "navanchauhan@gmail.com" + fromaddr = config['SMTP']['EMAIL'] toaddr = toEmail msg = MIMEMultipart() @@ -34,9 +43,9 @@ def email(compressedFile): p.add_header('Content-Disposition', "attachment; filename= %s" % filename) msg.attach(p) - s = smtplib.SMTP('smtp.gmail.com', 587) + s = smtplib.SMTP(config['SMTP']['SERVER'], config['SMTP']['PORT']) s.starttls() - s.login(fromaddr, 'okrs shoc ahtk idui') + s.login(fromaddr, config['SMTP']['PASSWORD']) text = msg.as_string() |