22 lines
564 B
Python
22 lines
564 B
Python
import unittest
|
|
import psycopg2
|
|
import os
|
|
|
|
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)
|
|
|
|
def tearDown(self):
|
|
self.conn.close()
|
|
|
|
def test_connection(self):
|
|
with self.conn.cursor() as cursor:
|
|
self.assertIsNotNone(cursor)
|