Set the DB variables in setup.py
parent
c6e984f2f9
commit
82ef8c4d40
|
@ -13,20 +13,4 @@ repos:
|
|||
stages: [commit]
|
||||
language: system
|
||||
entry: black
|
||||
types: [python]
|
||||
|
||||
- id: flake8
|
||||
name: flake8
|
||||
stages: [commit]
|
||||
language: system
|
||||
entry: flake8
|
||||
types: [python]
|
||||
exclude: setup.py
|
||||
|
||||
- id: mypy
|
||||
name: mypy
|
||||
stages: [commit]
|
||||
language: system
|
||||
entry: pipenv run mypy
|
||||
types: [python]
|
||||
pass_filenames: false
|
||||
types: [python]
|
|
@ -0,0 +1,11 @@
|
|||
import os
|
||||
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
|
||||
db_host = "212.235.208.113"
|
||||
db_database = "staw"
|
||||
db_user = "staw_db"
|
||||
|
||||
db_password = os.getenv("DB_PASSWORD")
|
|
@ -1,20 +1,15 @@
|
|||
import unittest
|
||||
|
||||
import psycopg2
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
from setup import db_database, db_host, db_password, db_user
|
||||
|
||||
db_host = "212.235.208.113"
|
||||
db_database = "staw"
|
||||
db_user = "staw_db"
|
||||
|
||||
class DatabaseConnection(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.conn = psycopg2.connect(host=db_host,
|
||||
user=db_user,
|
||||
password=os.getenv("DB_PASSWORD"),
|
||||
database=db_database)
|
||||
self.conn = psycopg2.connect(
|
||||
host=db_host, user=db_user, password=db_password, database=db_database,
|
||||
)
|
||||
|
||||
def tearDown(self):
|
||||
self.conn.close()
|
||||
|
|
Loading…
Reference in New Issue