From bf7bda8064dc2b259287ee01bb23a9d261ecbb41 Mon Sep 17 00:00:00 2001 From: artem Date: Wed, 2 Aug 2023 10:04:48 +0300 Subject: [PATCH] fixed import settings --- test_db/conftest.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/test_db/conftest.py b/test_db/conftest.py index e456f19..b8e3296 100644 --- a/test_db/conftest.py +++ b/test_db/conftest.py @@ -1,10 +1,7 @@ import psycopg2 import pytest from sshtunnel import SSHTunnelForwarder -from settings import ( - ssh_host, ssh_port, ssh_username, ssh_password, - db_host, db_port, db_username, db_password, db_name -) +import settings import api_response import query_from_db @@ -12,17 +9,17 @@ @pytest.fixture() def connection(): with SSHTunnelForwarder( - (ssh_host, ssh_port), - ssh_username=ssh_username, - ssh_password=ssh_password, - remote_bind_address=(db_host, db_port)) as tunnel: + (settings.ssh_host, settings.ssh_port), + ssh_username=settings.ssh_username, + ssh_password=settings.ssh_password, + remote_bind_address=(settings.db_host, settings.db_port)) as tunnel: print('Connected to server') conn = psycopg2.connect( host='localhost', port=tunnel.local_bind_port, - user=db_username, - password=db_password, - database=db_name + user=settings.db_username, + password=settings.db_password, + database=settings.db_name ) yield conn conn.close()