stress_at_work_analysis/test/database.py

20 lines
462 B
Python

import unittest
import psycopg2
from setup import db_database, db_host, db_password, db_user
class DatabaseConnection(unittest.TestCase):
def setUp(self):
self.conn = psycopg2.connect(
host=db_host, user=db_user, password=db_password, database=db_database,
)
def tearDown(self):
self.conn.close()
def test_connection(self):
with self.conn.cursor() as cursor:
self.assertIsNotNone(cursor)