Update unit tests

This commit is contained in:
Alexander Kukushkin
2015-05-20 18:21:08 +02:00
parent 1fb7b2cbe1
commit d56b8772e5
2 changed files with 15 additions and 2 deletions
+1
View File
@@ -52,6 +52,7 @@ class TestGovernor(unittest.TestCase):
with open('postgres0.yml', 'r') as f:
config = yaml.load(f)
g = Governor(config)
g.postgresql.should_use_s3_to_create_replica = false
g.etcd.base_client_url = 'http://remote'
g.etcd.client_url
g.postgresql.data_directory_empty = true
+14 -2
View File
@@ -7,10 +7,18 @@ from helpers.etcd import Cluster, Member
from helpers.postgresql import Postgresql
def nop(*args, **kwargs):
pass
def os_system(cmd):
return 0
def false(*args, **kwargs):
return False
class MockCursor:
def __init__(self):
@@ -75,8 +83,12 @@ class TestPostgresql(unittest.TestCase):
def set_up(self):
os.system = os_system
self.p = Postgresql({'name': 'test0', 'data_dir': 'data/test0', 'listen': '127.0.0.1, 127.0.0.2:5432', 'connect_address': '127.0.0.2:5432', 'replication': {
'username': 'replicator', 'password': 'rep-pass', 'network': '127.0.0.1/32'}, 'parameters': {'foo': 'bar'}, 'recovery_conf': {'foo': 'bar'}})
shutil.copy = nop
self.p = Postgresql({'name': 'test0', 'data_dir': 'data/test0', 'listen': '127.0.0.1, 127.0.0.2:5432',
'connect_address': '127.0.0.2:5432', 'superuser': {'password': ''},
'admin': {'username': 'admin', 'password': 'admin'}, 'replication': {
'username': 'replicator', 'password': 'rep-pass', 'network': '127.0.0.1/32'},
'parameters': {'foo': 'bar'}, 'recovery_conf': {'foo': 'bar'}})
psycopg2.connect = psycopg2_connect
if not os.path.exists(self.p.data_dir):
os.makedirs(self.p.data_dir)