Skip to content

Commit

Permalink
options are useful for other engines as well, not just psql
Browse files Browse the repository at this point in the history
  • Loading branch information
20c-ed authored and vegu committed Aug 21, 2024
1 parent 21cce69 commit 469252c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
5 changes: 0 additions & 5 deletions src/django_peeringdb/client_adaptor/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ def database_settings(db_config):
db[k] = v

db["ENGINE"] = "django.db.backends." + db["ENGINE"]

# Check if the ENGINE is not PostgreSQL, remove OPTIONS if it's present
if db["ENGINE"] != "django.db.backends.postgresql":
db.pop("OPTIONS", None)

return db


Expand Down
7 changes: 4 additions & 3 deletions tests/test_client_adaptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def test_database_settings_mysql():
assert db_config == expected


def test_database_settings_mysql_no_options():
def test_database_settings_mysql_options():
db_config = database_settings(
{
"engine": "mysql",
Expand All @@ -106,7 +106,7 @@ def test_database_settings_mysql_no_options():
"port": 3306,
"user": "test_user",
"password": "test_password",
"options": {"options": "-c some_option"},
"options": {},
}
)

Expand All @@ -117,10 +117,11 @@ def test_database_settings_mysql_no_options():
"PORT": 3306,
"USER": "test_user",
"PASSWORD": "test_password",
"OPTIONS": {},
}

assert db_config == expected
assert "OPTIONS" not in db_config
assert "OPTIONS" in db_config


def test_backend_setup():
Expand Down

0 comments on commit 469252c

Please sign in to comment.