Skip to content

Commit

Permalink
[FIX] Switch tests to use peque too
Browse files Browse the repository at this point in the history
  • Loading branch information
katyukha committed Jan 29, 2025
1 parent 58cf5eb commit 2b2f715
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions tests/basic.d
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ import odood.lib.odoo.config: OdooConfigBuilder;

import odood.cli.utils: printLogRecord;

import peque;


/// Create new database user in postgres db
void createDbUser(in string user, in string password) {
import dpq.connection: Connection;

auto connection_str = "host=%s port=%s dbname=postgres user=%s password=%s".format(
environment.get("POSTGRES_HOST", "localhost"),
environment.get("POSTGRES_PORT", "5432"),
environment.get("POSTGRES_USER", "odoo"),
environment.get("POSTGRES_PASSWORD", "odoo"));

infof("Connecting to postgres via: %s", connection_str);
auto connection = Connection(connection_str);
scope(exit) connection.close();
string[string] connection_params = [
"host": environment.get("POSTGRES_HOST", "localhost"),
"port": environment.get("POSTGRES_PORT", "5432"),
"user": environment.get("POSTGRES_USER", "odoo"),
"password": environment.get("POSTGRES_PASSWORD", "odoo"),
];
infof("Connecting to postgres via: %s", connection_params);
auto connection = Connection(connection_params);

auto res_user_exists = connection.exec(
"SELECT EXISTS(SELECT 1 FROM pg_roles WHERE rolname='%s')".format(user));
Expand Down

0 comments on commit 2b2f715

Please sign in to comment.