|
@@ -51,16 +51,20 @@ def test_flatten_dump_patterns_with_no_hooks_errors():
|
|
|
|
|
|
def test_remove_database_dumps_removes_dump_for_each_database():
|
|
def test_remove_database_dumps_removes_dump_for_each_database():
|
|
databases = [{'name': 'foo'}, {'name': 'bar'}]
|
|
databases = [{'name': 'foo'}, {'name': 'bar'}]
|
|
- flexmock(module).should_receive('make_database_dump_filename').and_return(
|
|
|
|
- 'databases/localhost/foo'
|
|
|
|
|
|
+ flexmock(module).should_receive('make_database_dump_filename').with_args(
|
|
|
|
+ 'databases', 'foo', None
|
|
|
|
+ ).and_return('databases/localhost/foo')
|
|
|
|
+ flexmock(module).should_receive('make_database_dump_filename').with_args(
|
|
|
|
+ 'databases', 'bar', None
|
|
).and_return('databases/localhost/bar')
|
|
).and_return('databases/localhost/bar')
|
|
- flexmock(module.os).should_receive('listdir').and_return([])
|
|
|
|
- flexmock(module.os).should_receive('rmdir')
|
|
|
|
|
|
|
|
- for name in ('foo', 'bar'):
|
|
|
|
- flexmock(module.os).should_receive('remove').with_args(
|
|
|
|
- 'databases/localhost/{}'.format(name)
|
|
|
|
- ).once()
|
|
|
|
|
|
+ flexmock(module.os).should_receive('remove').with_args('databases/localhost/foo').once()
|
|
|
|
+ flexmock(module.os).should_receive('remove').with_args('databases/localhost/bar').once()
|
|
|
|
+ flexmock(module.os).should_receive('listdir').with_args('databases/localhost').and_return(
|
|
|
|
+ ['bar']
|
|
|
|
+ ).and_return([])
|
|
|
|
+
|
|
|
|
+ flexmock(module.os).should_receive('rmdir').with_args('databases/localhost').once()
|
|
|
|
|
|
module.remove_database_dumps('databases', databases, 'SuperDB', 'test.yaml', dry_run=False)
|
|
module.remove_database_dumps('databases', databases, 'SuperDB', 'test.yaml', dry_run=False)
|
|
|
|
|