-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix handling of postgres DBs/roles with hyphens in them
closes #377
- Loading branch information
Showing
4 changed files
with
59 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ python: | |
- 3.4 | ||
- 3.5 | ||
- 3.6 | ||
services: | ||
- postgresql | ||
install: | ||
- pip install . | ||
before_script: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import unicode_literals | ||
|
||
from json import loads | ||
from os import environ | ||
|
||
from bundlewrap.utils.testing import host_os, make_repo, run | ||
|
||
|
||
if environ.get('TRAVIS') == "true": | ||
def test_create(tmpdir): | ||
make_repo( | ||
tmpdir, | ||
bundles={ | ||
"test": { | ||
'postgres_dbs': { | ||
"bw-test1": { | ||
'owner': "bw-test1", | ||
}, | ||
}, | ||
'postgres_roles': { | ||
"bw-test1": { | ||
'superuser': True, | ||
'password': 'potato', | ||
}, | ||
}, | ||
}, | ||
}, | ||
nodes={ | ||
"localhost": { | ||
'bundles': ["test"], | ||
'os': host_os(), | ||
}, | ||
}, | ||
) | ||
|
||
stdout, stderr, rcode = run("bw apply localhost", path=str(tmpdir)) | ||
assert rcode == 0 | ||
|
||
stdout, stderr, rcode = run("bw items --state localhost postgres_db:bw-test1", path=str(tmpdir)) | ||
assert rcode == 0 | ||
assert loads(stdout.decode()) == {'owner': "bw-test1"} | ||
|
||
stdout, stderr, rcode = run("bw items --state localhost postgres_role:bw-test1", path=str(tmpdir)) | ||
assert rcode == 0 | ||
assert loads(stdout.decode()) == { | ||
'can_login': True, | ||
'password_hash': "md5ecba3aec62c5aabf6480de6352182004", | ||
'superuser': True, | ||
} | ||
|
||
stdout, stderr, rcode = run("dropdb bw-test1", path=str(tmpdir)) | ||
assert rcode == 0 | ||
stdout, stderr, rcode = run("dropuser bw-test1", path=str(tmpdir)) | ||
assert rcode == 0 |