def test_db_alter(self): postgres.db_alter('dbname', user='******', host='testhost', port='testport', maintenance_db='maint_db', password='******', tablespace='testspace', owner='otheruser', runas='foo') postgres._run_psql.assert_has_calls([ call([ '/usr/bin/pgsql', '--no-align', '--no-readline', '--no-password', '--username', 'testuser', '--host', 'testhost', '--port', 'testport', '--dbname', 'maint_db', '-c', 'ALTER DATABASE "dbname" OWNER TO "otheruser"' ], host='testhost', user='******', password='******', runas='foo', port='testport'), call([ '/usr/bin/pgsql', '--no-align', '--no-readline', '--no-password', '--username', 'testuser', '--host', 'testhost', '--port', 'testport', '--dbname', 'maint_db', '-c', 'ALTER DATABASE "dbname" SET TABLESPACE "testspace"' ], host='testhost', user='******', password='******', runas='foo', port='testport') ])
def test_db_alter(self): postgres.db_alter('dbname', user='******', host='testhost', port='testport', maintenance_db='maint_db', password='******', tablespace='testspace', owner='otheruser', runas='foo') postgres._run_psql.assert_called_once_with( '/usr/bin/pgsql --no-align --no-readline --username testuser ' '--host testhost --port testport --dbname maint_db ' '-c \'ALTER DATABASE "dbname" OWNER TO "otheruser"\'', host='testhost', user='******', password='******', runas='foo', port='testport')
def test_db_alter(self): postgres.db_alter('dbname', user='******', host='testhost', port='testport', maintenance_db='maint_db', password='******', tablespace='testspace', owner='otheruser', runas='foo') postgres._run_psql.assert_called_once_with( '/usr/bin/pgsql --no-align --no-readline --no-password --username testuser ' '--host testhost --port testport --dbname maint_db ' '-c \'ALTER DATABASE "dbname" OWNER TO "otheruser"\'', host='testhost', user='******', password='******', runas='foo', port='testport')
def test_db_alter_owner_recurse(self): postgres.db_alter('dbname', user='******', host='testhost', port='testport', maintenance_db='maint_db', password='******', tablespace='testspace', owner='otheruser', owner_recurse=True, runas='foo') postgres.owner_to.assert_called_once_with('dbname', 'otheruser', user='******', host='testhost', port='testport', password='******', runas='foo')
def test_db_alter(self): postgres.db_alter('dbname', user='******', host='testhost', port='testport', maintenance_db='maint_db', password='******', tablespace='testspace', owner='otheruser', runas='foo') postgres._run_psql.assert_has_calls([ call(['/usr/bin/pgsql', '--no-align', '--no-readline', '--no-password', '--username', 'testuser', '--host', 'testhost', '--port', 'testport', '--dbname', 'maint_db', '-c', 'ALTER DATABASE "dbname" OWNER TO "otheruser"'], host='testhost', user='******', password='******', runas='foo', port='testport'), call(['/usr/bin/pgsql', '--no-align', '--no-readline', '--no-password', '--username', 'testuser', '--host', 'testhost', '--port', 'testport', '--dbname', 'maint_db', '-c', 'ALTER DATABASE "dbname" SET TABLESPACE "testspace"'], host='testhost', user='******', password='******', runas='foo', port='testport') ])