def test_flush_index(self, mock_open, mock_serialize_index, mock_dump, mock_index): cache = Cache('test') mock_serialize_index.return_value = 'dict_to_flush' cache._flush_index() mock_dump.assert_called_with('dict_to_flush', mock.ANY)