Mock remove_data_directory in the pg_rewind test.

This commit is contained in:
Oleksii Kliukin
2015-09-30 16:32:56 +02:00
parent e39d318732
commit a500781b6d
+2 -1
View File
@@ -3,7 +3,7 @@ import psycopg2
import shutil
import unittest
from mock import Mock, patch
from mock import Mock, MagicMock, patch
from patroni.dcs import Cluster, Leader, Member
from patroni.exceptions import PostgresException, PostgresConnectionException
from patroni.postgresql import Postgresql
@@ -150,6 +150,7 @@ class TestPostgresql(unittest.TestCase):
self.assertFalse(self.p.pg_rewind(self.leader))
@patch('patroni.postgresql.Postgresql.pg_rewind', return_value=False)
@patch('patroni.postgresql.Postgresql.remove_data_directory', MagicMock(return_value=True))
def test_follow_the_leader(self, mock_pg_rewind):
self.p.demote(self.leader)
self.p.follow_the_leader(None)