formatting fix
This commit is contained in:
parent
af1cc27988
commit
3aa88085ed
1 changed files with 23 additions and 9 deletions
|
@ -19,6 +19,7 @@ def test_dump_databases_logs_and_skips_if_dump_already_exists():
|
||||||
|
|
||||||
assert module.dump_databases(databases, 'test.yaml', {}, dry_run=False) == []
|
assert module.dump_databases(databases, 'test.yaml', {}, dry_run=False) == []
|
||||||
|
|
||||||
|
|
||||||
def test_dump_databases_dumps_each_database():
|
def test_dump_databases_dumps_each_database():
|
||||||
databases = [
|
databases = [
|
||||||
{'path': '/path/to/database1', 'name': 'database1'},
|
{'path': '/path/to/database1', 'name': 'database1'},
|
||||||
|
@ -35,7 +36,11 @@ def test_dump_databases_dumps_each_database():
|
||||||
flexmock(module).should_receive('dump.create_parent_directory_for_dump')
|
flexmock(module).should_receive('dump.create_parent_directory_for_dump')
|
||||||
flexmock(module).should_receive('execute_command').and_return('process')
|
flexmock(module).should_receive('execute_command').and_return('process')
|
||||||
|
|
||||||
assert module.dump_databases(databases, 'test.yaml', {}, dry_run = False) == ['process', 'process']
|
assert module.dump_databases(databases, 'test.yaml', {}, dry_run=False) == [
|
||||||
|
'process',
|
||||||
|
'process',
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
def test_dump_databases_does_not_dump_if_dry_run():
|
def test_dump_databases_does_not_dump_if_dry_run():
|
||||||
databases = [{'path': '/path/to/database', 'name': 'database'}]
|
databases = [{'path': '/path/to/database', 'name': 'database'}]
|
||||||
|
@ -51,13 +56,17 @@ def test_dump_databases_does_not_dump_if_dry_run():
|
||||||
|
|
||||||
assert module.dump_databases(databases, 'test.yaml', {}, dry_run=True) == []
|
assert module.dump_databases(databases, 'test.yaml', {}, dry_run=True) == []
|
||||||
|
|
||||||
|
|
||||||
def test_restore_database_dump_restores_database():
|
def test_restore_database_dump_restores_database():
|
||||||
database_config = [{'path': '/path/to/database', 'name': 'database'}]
|
database_config = [{'path': '/path/to/database', 'name': 'database'}]
|
||||||
extract_process = flexmock(stdout=flexmock())
|
extract_process = flexmock(stdout=flexmock())
|
||||||
|
|
||||||
flexmock(module).should_receive('execute_command_with_processes').and_return('process')
|
flexmock(module).should_receive('execute_command_with_processes').and_return('process')
|
||||||
|
|
||||||
module.restore_database_dump(database_config, 'test.yaml', {}, dry_run = False, extract_process = extract_process)
|
module.restore_database_dump(
|
||||||
|
database_config, 'test.yaml', {}, dry_run=False, extract_process=extract_process
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_restore_database_dump_does_not_restore_database_if_dry_run():
|
def test_restore_database_dump_does_not_restore_database_if_dry_run():
|
||||||
database_config = [{'path': '/path/to/database', 'name': 'database'}]
|
database_config = [{'path': '/path/to/database', 'name': 'database'}]
|
||||||
|
@ -65,11 +74,16 @@ def test_restore_database_dump_does_not_restore_database_if_dry_run():
|
||||||
|
|
||||||
flexmock(module).should_receive('execute_command_with_processes').never()
|
flexmock(module).should_receive('execute_command_with_processes').never()
|
||||||
|
|
||||||
module.restore_database_dump(database_config, 'test.yaml', {}, dry_run = True, extract_process = extract_process)
|
module.restore_database_dump(
|
||||||
|
database_config, 'test.yaml', {}, dry_run=True, extract_process=extract_process
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_restore_database_dump_raises_error_if_database_config_is_invalid():
|
def test_restore_database_dump_raises_error_if_database_config_is_invalid():
|
||||||
database_config = []
|
database_config = []
|
||||||
extract_process = flexmock(stdout=flexmock())
|
extract_process = flexmock(stdout=flexmock())
|
||||||
|
|
||||||
with pytest.raises(ValueError):
|
with pytest.raises(ValueError):
|
||||||
module.restore_database_dump(database_config, 'test.yaml', {}, dry_run = False, extract_process = extract_process)
|
module.restore_database_dump(
|
||||||
|
database_config, 'test.yaml', {}, dry_run=False, extract_process=extract_process
|
||||||
|
)
|
||||||
|
|
Loading…
Reference in a new issue