def test_restore_dump_drop(self, mock_dump_cmd, mock_restore_cmd):
     connector = MongoDumpConnector()
     dump = connector.create_dump()
     # Without
     connector.drop = False
     connector.restore_dump(dump)
     self.assertNotIn('--drop', mock_restore_cmd.call_args[0][0])
     # With
     connector.drop = True
     connector.restore_dump(dump)
     self.assertIn(' --drop', mock_restore_cmd.call_args[0][0])
 def test_restore_dump_password(self, mock_dump_cmd, mock_restore_cmd):
     connector = MongoDumpConnector()
     dump = connector.create_dump()
     # Without
     connector.settings.pop('PASSWORD', None)
     connector.restore_dump(dump)
     self.assertNotIn(' --password ', mock_restore_cmd.call_args[0][0])
     # With
     connector.settings['PASSWORD'] = '******'
     connector.restore_dump(dump)
     self.assertIn(' --password foo', mock_restore_cmd.call_args[0][0])
 def test_restore_dump_object_check(self, mock_dump_cmd, mock_restore_cmd):
     connector = MongoDumpConnector()
     dump = connector.create_dump()
     # Without
     connector.object_check = False
     connector.restore_dump(dump)
     self.assertNotIn('--objcheck', mock_restore_cmd.call_args[0][0])
     # With
     connector.object_check = True
     connector.restore_dump(dump)
     self.assertIn(' --objcheck', mock_restore_cmd.call_args[0][0])
Ejemplo n.º 4
0
 def test_restore_dump_drop(self, mock_dump_cmd, mock_restore_cmd):
     connector = MongoDumpConnector()
     dump = connector.create_dump()
     # Without
     connector.drop = False
     connector.restore_dump(dump)
     self.assertNotIn('--drop', mock_restore_cmd.call_args[0][0])
     # With
     connector.drop = True
     connector.restore_dump(dump)
     self.assertIn(' --drop', mock_restore_cmd.call_args[0][0])
 def test_restore_dump_user(self, mock_dump_cmd, mock_restore_cmd):
     connector = MongoDumpConnector()
     dump = connector.create_dump()
     # Without
     connector.settings.pop('USER', None)
     connector.restore_dump(dump)
     self.assertNotIn(' --username ', mock_restore_cmd.call_args[0][0])
     # With
     connector.settings['USER'] = '******'
     connector.restore_dump(dump)
     self.assertIn(' --username foo', mock_restore_cmd.call_args[0][0])
Ejemplo n.º 6
0
 def test_restore_dump_object_check(self, mock_dump_cmd, mock_restore_cmd):
     connector = MongoDumpConnector()
     dump = connector.create_dump()
     # Without
     connector.object_check = False
     connector.restore_dump(dump)
     self.assertNotIn('--objcheck', mock_restore_cmd.call_args[0][0])
     # With
     connector.object_check = True
     connector.restore_dump(dump)
     self.assertIn(' --objcheck', mock_restore_cmd.call_args[0][0])
Ejemplo n.º 7
0
 def test_restore_dump_password(self, mock_dump_cmd, mock_restore_cmd):
     connector = MongoDumpConnector()
     dump = connector.create_dump()
     # Without
     connector.settings.pop('PASSWORD', None)
     connector.restore_dump(dump)
     self.assertNotIn(' --password ', mock_restore_cmd.call_args[0][0])
     # With
     connector.settings['PASSWORD'] = '******'
     connector.restore_dump(dump)
     self.assertIn(' --password foo', mock_restore_cmd.call_args[0][0])
Ejemplo n.º 8
0
 def test_restore_dump_user(self, mock_dump_cmd, mock_restore_cmd):
     connector = MongoDumpConnector()
     dump = connector.create_dump()
     # Without
     connector.settings.pop('USER', None)
     connector.restore_dump(dump)
     self.assertNotIn(' --username ', mock_restore_cmd.call_args[0][0])
     # With
     connector.settings['USER'] = '******'
     connector.restore_dump(dump)
     self.assertIn(' --username foo', mock_restore_cmd.call_args[0][0])
 def test_restore_dump(self, mock_dump_cmd, mock_restore_cmd):
     connector = MongoDumpConnector()
     dump = connector.create_dump()
     connector.restore_dump(dump)
     # Test cmd
     self.assertTrue(mock_restore_cmd.called)
Ejemplo n.º 10
0
 def test_restore_dump(self, mock_dump_cmd, mock_restore_cmd):
     connector = MongoDumpConnector()
     dump = connector.create_dump()
     connector.restore_dump(dump)
     # Test cmd
     self.assertTrue(mock_restore_cmd.called)