Skip to content

Commit

Permalink
Fixed commented issues
Browse files Browse the repository at this point in the history
1. Fixed issue where namespace was in classname output of
EnumerateClasses when qualifier filters defined and modified tests

2. Moved the qualifier_filter_options to _common_options.py since
they may be used in further commands

3. Moved common processing functions in cmd_class to its own area in the
code and added comment block before that code.

4. Added more tests for class find and class enumerate with filters.
  • Loading branch information
KSchopmeyer committed Dec 10, 2019
1 parent 43f1c3d commit fc55cbf
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 36 deletions.
83 changes: 53 additions & 30 deletions docs/pywbemcli/cmdshelp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,12 @@ Help text for ``pywbemcli class enumerate`` (see :ref:`class enumerate command`)
that are not indications (--no-indication).
If the option is not defined no filtering
occurs
--experimental / --no-experimental
Filter the returned classes to return only
experimental classes (--experimental) or
classes that are not experimental (--no-
iexperimental). If the option is not defined
no filtering occurs
-h, --help Show this message and exit.


Expand Down Expand Up @@ -425,12 +431,29 @@ Help text for ``pywbemcli class find`` (see :ref:`class find command`):
pywbemcli -n myconn class find *Foo*

Options:
-n, --namespace NAMESPACE Add a namespace to the search scope. May be
specified multiple times. Default: Search in all
namespaces of the server.
-s, --sort Sort by namespace. Default is to sort by
classname
-h, --help Show this message and exit.
-n, --namespace NAMESPACE Add a namespace to the search scope. May be
specified multiple times. Default: Search in
all namespaces of the server.
-s, --sort Sort by namespace. Default is to sort by
classname
--association / --no-association
Filter the returned classes to return only
indication classes (--association) or
classes that are not associations(--no-
association). If the option is not defined
no filtering occurs
--indication / --no-indication Filter the returned classes to return only
indication classes (--indication) or classes
that are not indications (--no-indication).
If the option is not defined no filtering
occurs
--experimental / --no-experimental
Filter the returned classes to return only
experimental classes (--experimental) or
classes that are not experimental (--no-
iexperimental). If the option is not defined
no filtering occurs
-h, --help Show this message and exit.


.. _`pywbemcli class get --help`:
Expand Down Expand Up @@ -1077,11 +1100,11 @@ Help text for ``pywbemcli instance associators`` (see :ref:`instance associators
--no, --names-only Retrieve only the object paths (names).
Default: Retrieve the complete objects
including object paths.
-k, --key KEYNAME=VALUE Value for a key in keybinding of
CIMInstanceName. May be specified multiple
-k, --key KEYNAME=VALUE Value for a key in keybinding of CIM
instance name. May be specified multiple
times. Allows defining keys without the
issues of quotes. Default: No initial
properties provided.
issues of quotes. Default: No keybindings
provided.
-n, --namespace NAMESPACE Namespace to use for this command, instead
of the default namespace of the connection.
-s, --summary Show only a summary (count) of the objects.
Expand Down Expand Up @@ -1227,10 +1250,10 @@ Help text for ``pywbemcli instance delete`` (see :ref:`instance delete command`)
namespace of the connection.

Options:
-k, --key KEYNAME=VALUE Value for a key in keybinding of CIMInstanceName.
May be specified multiple times. Allows defining
keys without the issues of quotes. Default: No
initial properties provided.
-k, --key KEYNAME=VALUE Value for a key in keybinding of CIM instance
name. May be specified multiple times. Allows
defining keys without the issues of quotes.
Default: No keybindings provided.
-n, --namespace NAMESPACE Namespace to use for this command, instead of the
default namespace of the connection.
-h, --help Show this message and exit.
Expand Down Expand Up @@ -1376,11 +1399,11 @@ Help text for ``pywbemcli instance get`` (see :ref:`instance get command`):
not in the object(s) will be ignored. The
empty string will include no properties.
Default: Do not filter properties.
-k, --key KEYNAME=VALUE Value for a key in keybinding of
CIMInstanceName. May be specified multiple
-k, --key KEYNAME=VALUE Value for a key in keybinding of CIM
instance name. May be specified multiple
times. Allows defining keys without the
issues of quotes. Default: No initial
properties provided.
issues of quotes. Default: No keybindings
provided.
-n, --namespace NAMESPACE Namespace to use for this command, instead
of the default namespace of the connection.
-h, --help Show this message and exit.
Expand Down Expand Up @@ -1443,11 +1466,11 @@ Help text for ``pywbemcli instance invokemethod`` (see :ref:`instance invokemeth
Array property values are specified as a
comma-separated list; embedded instances are
not supported. Default: No input parameters.
-k, --key KEYNAME=VALUE Value for a key in keybinding of
CIMInstanceName. May be specified multiple
-k, --key KEYNAME=VALUE Value for a key in keybinding of CIM
instance name. May be specified multiple
times. Allows defining keys without the
issues of quotes. Default: No initial
properties provided.
issues of quotes. Default: No keybindings
provided.
-n, --namespace NAMESPACE Namespace to use for this command, instead
of the default namespace of the connection.
-h, --help Show this message and exit.
Expand Down Expand Up @@ -1517,11 +1540,11 @@ Help text for ``pywbemcli instance modify`` (see :ref:`instance modify command`)
change, to allow for verification of
parameters. Default: Do not prompt for
confirmation.
-k, --key KEYNAME=VALUE Value for a key in keybinding of
CIMInstanceName. May be specified multiple
-k, --key KEYNAME=VALUE Value for a key in keybinding of CIM
instance name. May be specified multiple
times. Allows defining keys without the
issues of quotes. Default: No initial
properties provided.
issues of quotes. Default: No keybindings
provided.
-n, --namespace NAMESPACE Namespace to use for this command, instead
of the default namespace of the connection.
-h, --help Show this message and exit.
Expand Down Expand Up @@ -1634,11 +1657,11 @@ Help text for ``pywbemcli instance references`` (see :ref:`instance references c
--no, --names-only Retrieve only the object paths (names).
Default: Retrieve the complete objects
including object paths.
-k, --key KEYNAME=VALUE Value for a key in keybinding of
CIMInstanceName. May be specified multiple
-k, --key KEYNAME=VALUE Value for a key in keybinding of CIM
instance name. May be specified multiple
times. Allows defining keys without the
issues of quotes. Default: No initial
properties provided.
issues of quotes. Default: No keybindings
provided.
-n, --namespace NAMESPACE Namespace to use for this command, instead
of the default namespace of the connection.
-s, --summary Show only a summary (count) of the objects.
Expand Down
24 changes: 19 additions & 5 deletions tests/unit/test_class_cmds.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ class TST_MemberOfFamilyCollection {
SIMPLE_MOCK_FILE, OK],

['Verify class command enumerate with --association filter.',
['enumerate', '--association', '--names_only'],
['enumerate', '--association', '--names-only'],
{'stdout': ['TST_Lineage', 'TST_MemberOfFamilyCollection'],
'test': 'innows'},
SIMPLE_ASSOC_MOCK_FILE, OK],
Expand All @@ -542,22 +542,36 @@ class TST_MemberOfFamilyCollection {
'TST_Person REF family;',
'TST_Person REF member;', '};'],
'test': 'innows'},
SIMPLE_ASSOC_MOCK_FILE, RUN],
SIMPLE_ASSOC_MOCK_FILE, OK],

['Verify class command enumerate with --no-association filter and '
'no-qualifiers. Tests no qualifiers on parameters',
['enumerate', '--no-association', '--no-qualifiers'],
{'stdout': ['class CIM_Foo { string InstanceID;',
'uint32 IntegerProp;',
'uint32 Fuzzy(',
'string TestInOutParameter,',
'CIM_Foo REF TestRef,',
'string OutputParam,',
'uint32 OutputRtnValue);',
'uint32 DeleteNothing();', '};'],
'test': 'innows'},
SIMPLE_MOCK_FILE, OK],

['Verify class command enumerate with --association filter.',
['enumerate', '--no-association', '--names_only'],
['enumerate', '--no-association', '--names-only'],
{'stdout': ['TST_FamilyCollection', 'TST_Person'],
'test': 'in'},
SIMPLE_ASSOC_MOCK_FILE, OK],

['Verify class command enumerate with --indication filter.',
['enumerate', '--indication', '--names_only'],
['enumerate', '--indication', '--names-only'],
{'stdout': ['TST_Indication', 'TST_IndicationExperimental'],
'test': 'innows'},
QUALIFIER_FILTER_MODEL, OK],

['Verify class command enumerate with --no-indication filter.',
['enumerate', '--no-indication', '--names_only'],
['enumerate', '--no-indication', '--names-only'],
{'stdout': ['TST_FamilyCollection',
'TST_Lineage',
'TST_MemberOfFamilyCollection',
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_instance_cmds.py
Original file line number Diff line number Diff line change
Expand Up @@ -2031,4 +2031,4 @@ def test_execute_pywbemcli(self, desc, inputs, exp_response, mock,
Execute pybemcli with the defined input and test output.
"""
self.command_test(desc, self.command_group, inputs, exp_response,
mock, condition, verbose=True)
mock, condition, verbose=False)

0 comments on commit fc55cbf

Please sign in to comment.