Skip to content

Commit

Permalink
issue #1334 - Fix issue where IterQueryInstances params reversed
Browse files Browse the repository at this point in the history
Fixes issue #1334 where the parameters for QueryLanguage and Query were
reversed in the ExecQuery call that is the fallback if the
OpenQueryInstances fails or use_pull_operations is False.

Also fixes test results for this test (also reversed) and adds comment
to changes.rst
  • Loading branch information
KSchopmeyer authored and andy-maier committed Aug 19, 2018
1 parent e62aa24 commit 3db7df3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
5 changes: 4 additions & 1 deletion docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ Released: not yet

**Bug fixes:**

* Fix issue in IterQueryInstances where the QueryLanguage and Query parameters
were reveresed in the fallback call to ExecQuery method. See issue #1334.

**Enhancements:**

**Known issues:**
Expand Down Expand Up @@ -94,7 +97,7 @@ Released: 2018-05-18
objects that states that `copy.copy()` and `copy.deepcopy()` can be used
to create completely shallow or completely deep copies (Issue #1251).

** Cleanup:**
**Cleanup:**

* Removed one level of superflous copies of dictionaries in the `copy()`
methods of the CIM object classes. These dictionaries are already copied
Expand Down
5 changes: 3 additions & 2 deletions pywbem/cim_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -5874,8 +5874,9 @@ def generator(self):
raise ValueError('ExecQuery does not support '
'ContinueOnError.')

_instances = self.ExecQuery(FilterQuery,
FilterQueryLanguage,
# The parameters are QueryLanguage and Query for ExecQuery
_instances = self.ExecQuery(FilterQueryLanguage,
FilterQuery,
namespace=namespace, **extra)

rtn = IterQueryInstancesReturn(_instances)
Expand Down
13 changes: 3 additions & 10 deletions testsuite/test_itermethods.py
Original file line number Diff line number Diff line change
Expand Up @@ -1447,20 +1447,13 @@ class TestIterQueryInstances(object): # pylint: disable=invalid-name
"ns", [None, 'test/testnamespace']
)
@pytest.mark.parametrize(
"ql,query", [(None, None), ('CQL', 'SELECT from *')]
"ql, query", [(None, None), ('CQL', 'SELECT from *')]
)
def test_orig_operation_success(self, use_pull_param, tst_insts, ns,
ql, query):
# pylint: disable=no-self-use
"""
Test Use of IterAssociatorInstances from IterAssociatorInstances.
This forces the enumerate by mocking NOT_Supported on the
OpenAssociatorInstancess.
It is parameterized to test variations on all parameters. Note
that it only tests legal parameters.
It confirms that AssociatorInstances receives the correct parameter
for all parameters.
Test Use IterQueryInstances using the original ExecQuery op
"""
conn = WBEMConnection('dummy', use_pull_operations=use_pull_param)

Expand All @@ -1476,7 +1469,7 @@ def test_orig_operation_success(self, use_pull_param, tst_insts, ns,
q_result = conn.IterQueryInstances(ql, query, namespace=ns)
result_insts = [inst for inst in q_result.generator]

conn.ExecQuery.assert_called_with(query, ql, namespace=ns)
conn.ExecQuery.assert_called_with(ql, query, namespace=ns)

assert(q_result.query_result_class is None)
assert(conn._use_query_pull_operations is False)
Expand Down

0 comments on commit 3db7df3

Please sign in to comment.