Skip to content

Commit

Permalink
fixed import settings
Browse files Browse the repository at this point in the history
  • Loading branch information
mikyyL committed Aug 2, 2023
1 parent 743de57 commit bf7bda8
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions test_db/conftest.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
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


@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()
Expand Down

0 comments on commit bf7bda8

Please sign in to comment.