Skip to content

Commit

Permalink
enhance: add quick and dirty tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Guts committed Jul 22, 2024
1 parent f4ceaaa commit fdfeb26
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions dicogis/models/database_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,26 @@ def store_in_pgservice_file(self) -> tuple[bool, str]:
)
logger.error(err_msg, stack_info=True)
return False, err_msg


if __name__ == "__main__":
db = DatabaseConnection(service_name="empty")
print(db.connection_params_as_dict, bool(db.connection_params_as_dict))
db.store_in_pgservice_file()

db = DatabaseConnection(service_name="minimal", host="localhost")
print(db.connection_params_as_dict, bool(db.connection_params_as_dict))
db.store_in_pgservice_file()

pgserviceparser.remove_service("minimal")

new_srv_settings = {
"host": "localhost",
"dbname": "best_database_ever",
"port": 5432,
"user": "ro_gis_user",
}
new_srv = pgserviceparser.write_service(
service_name="gis_prod_ro", settings=new_srv_settings, add_if_not_exists=True
)
assert isinstance(new_srv, dict)

0 comments on commit fdfeb26

Please sign in to comment.