Skip to content

Commit

Permalink
fix parameter name, user vs username (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
glasstiger authored Jul 29, 2024
1 parent 654b1b6 commit 11eb8a4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[project]
# https://pip.pypa.io/en/stable/reference/build-system/pyproject-toml/
name = 'questdb-connect'
version = '1.0.11' # Standalone production version (with engine)
#version = '0.0.104' # testing version
version = '1.0.12' # Standalone production version (with engine)
# version = '0.0.105' # testing version
authors = [{ name = 'questdb.io', email = '[email protected]' }]
description = "SqlAlchemy library"
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion src/questdb_connect/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def cursor_factory(*args, **kwargs):
def connect(**kwargs):
host = kwargs.get("host") or "127.0.0.1"
port = kwargs.get("port") or 8812
user = kwargs.get("username") or "admin"
user = kwargs.get("user") or "admin"
password = kwargs.get("password") or "quest"
database = kwargs.get("database") or "main"
conn = psycopg2.connect(
Expand Down
15 changes: 15 additions & 0 deletions tests/test_username.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import pytest
from _pytest.outcomes import fail
from psycopg2 import OperationalError
from sqlalchemy import create_engine


def test_user(test_engine, test_model):
engine = create_engine("questdb://admin:quest@localhost:8812/qdb")
engine.connect()

engine = create_engine("questdb://user1:quest@localhost:8812/qdb")
with pytest.raises(OperationalError) as exc_info:
engine.connect()
if not str(exc_info.value).__contains__("ERROR: invalid username/password"):
fail()

0 comments on commit 11eb8a4

Please sign in to comment.