def test_create_dump_user(self, mock_dump_cmd):
     connector = MongoDumpConnector()
     # Without
     connector.settings.pop('USER', None)
     connector.create_dump()
     self.assertNotIn(' --user ', mock_dump_cmd.call_args[0][0])
     # With
     connector.settings['USER'] = '******'
     connector.create_dump()
     self.assertIn(' --username foo', mock_dump_cmd.call_args[0][0])
 def test_create_dump_password(self, mock_dump_cmd):
     connector = MongoDumpConnector()
     # Without
     connector.settings.pop('PASSWORD', None)
     connector.create_dump()
     self.assertNotIn(' --password ', mock_dump_cmd.call_args[0][0])
     # With
     connector.settings['PASSWORD'] = '******'
     connector.create_dump()
     self.assertIn(' --password foo', mock_dump_cmd.call_args[0][0])
 def test_create_dump_password(self, mock_dump_cmd):
     connector = MongoDumpConnector()
     # Without
     connector.settings.pop('PASSWORD', None)
     connector.create_dump()
     self.assertNotIn(' --password ', mock_dump_cmd.call_args[0][0])
     # With
     connector.settings['PASSWORD'] = '******'
     connector.create_dump()
     self.assertIn(' --password foo', mock_dump_cmd.call_args[0][0])
 def test_create_dump_user(self, mock_dump_cmd):
     connector = MongoDumpConnector()
     # Without
     connector.settings.pop('USER', None)
     connector.create_dump()
     self.assertNotIn(' --user ', mock_dump_cmd.call_args[0][0])
     # With
     connector.settings['USER'] = '******'
     connector.create_dump()
     self.assertIn(' --username foo', mock_dump_cmd.call_args[0][0])
 def test_create_dump(self, mock_dump_cmd):
     connector = MongoDumpConnector()
     dump = connector.create_dump()
     # Test dump
     dump_content = dump.read()
     self.assertTrue(dump_content)
     self.assertEqual(dump_content, b'foo')
     # Test cmd
     self.assertTrue(mock_dump_cmd.called)
 def test_create_dump(self, mock_dump_cmd):
     connector = MongoDumpConnector()
     dump = connector.create_dump()
     # Test dump
     dump_content = dump.read()
     self.assertTrue(dump_content)
     self.assertEqual(dump_content, b'foo')
     # Test cmd
     self.assertTrue(mock_dump_cmd.called)
 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_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])
 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_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])
 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)
 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)