mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-25 14:53:37 +00:00
Increase the tests coverage.
This commit is contained in:
@@ -80,3 +80,8 @@ class TestPatroni(unittest.TestCase):
|
||||
self.assertTrue(self.p.nofailover)
|
||||
self.p.tags['nofailover'] = None
|
||||
self.assertFalse(self.p.nofailover)
|
||||
|
||||
def test_replicatefrom(self):
|
||||
self.assertIsNone(self.p.replicatefrom)
|
||||
self.p.tags['replicatefrom'] = 'foo'
|
||||
self.assertEqual(self.p.replicatefrom, 'foo')
|
||||
|
||||
@@ -3,7 +3,7 @@ from mock import MagicMock, patch, PropertyMock
|
||||
import os
|
||||
import psycopg2
|
||||
import subprocess
|
||||
from patroni.scripts.wale_restore import WALERestore
|
||||
from patroni.scripts.wale_restore import WALERestore, main
|
||||
|
||||
|
||||
def fake_cursor_fetchone(*args, **kwargs):
|
||||
@@ -91,3 +91,7 @@ class TestWALERestore(unittest.TestCase):
|
||||
with patch.object(self.wale_restore, 'should_use_s3_to_create_replica', MagicMock(return_value=True)):
|
||||
with patch.object(self.wale_restore, 'create_replica_with_s3', MagicMock(return_value=0)):
|
||||
self.assertEqual(self.wale_restore.run(), 0)
|
||||
|
||||
def test_main(self):
|
||||
with patch('sys.exit', MagicMock(return_value=0)):
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user