Skip to content

Commit

Permalink
Merge d663f17 into 5b53987
Browse files Browse the repository at this point in the history
  • Loading branch information
KSchopmeyer committed Oct 12, 2020
2 parents 5b53987 + d663f17 commit 89baba0
Show file tree
Hide file tree
Showing 8 changed files with 306 additions and 281 deletions.
5 changes: 5 additions & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,11 @@ Released: not yet

* Docs: Changed Sphinx theme to sphinx_rtd_theme. (see issue #792)

* Modified the class WbemServerMock in tests/unit/testmock to define a
WBEM server configuration that includes multiple namespaces, a user and
an interop namespace to test cross-namespace mock. (see issue #183)


**Known issues:**

* See `list of open issues`_.
Expand Down
6 changes: 3 additions & 3 deletions docs/pywbemcli/cmdshelp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1600,10 +1600,10 @@ Help text for ``pywbemcli profile centralinsts`` (see :ref:`profile centralinsts
-o, --organization ORG-NAME Filter by the defined organization. (ex. -o DMTF
-p, --profile PROFILE-NAME Filter by the profile name. (ex. -p Array
--cc, --central-class CLASSNAME
Optional. Required only if profiles supports only scopig methodology
Optional. Required only if profiles supports only scoping methodology
--sc, --scoping-class CLASSNAME
Optional. Required only if profiles supports only scopig methodology
--sp, --scoping-path CLASSLIST Optional. Required only if profiles supports only scopig methodology. Multiples
Optional. Required only if profiles supports only scoping methodology
--sp, --scoping-path CLASSLIST Optional. Required only if profiles supports only scoping methodology. Multiples
allowed

--rd, --reference-direction [snia|dmtf]
Expand Down
6 changes: 3 additions & 3 deletions pywbemtools/pywbemcli/_cmd_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@ def profile_list(context, **options):
@click.option('--cc', '--central-class', 'central_class', type=str,
metavar='CLASSNAME', required=False,
help=u'Optional. Required only if profiles supports only '
u'scopig methodology')
u'scoping methodology')
@click.option('--sc', '--scoping-class', 'scoping_class', type=str,
metavar='CLASSNAME', required=False,
help=u'Optional. Required only if profiles supports only '
u'scopig methodology')
u'scoping methodology')
@click.option('--sp', '--scoping-path', 'scoping_path', type=str,
metavar='CLASSLIST', required=False, multiple=True,
help=u'Optional. Required only if profiles supports only '
u'scopig methodology. Multiples allowed')
u'scoping methodology. Multiples allowed')
@click.option('--rd', '--reference-direction', 'reference_direction',
type=click.Choice(['snia', 'dmtf']),
default='dmtf',
Expand Down
11 changes: 4 additions & 7 deletions pywbemtools/pywbemcli/_cmd_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,17 +192,14 @@ def cmd_server_info(context):
# execute the namespaces to force contact with server before
# turning off the spinner.
server = context.wbem_server
server.namespaces # pylint: disable=pointless-statement
namespaces = sorted(server.namespaces)
context.spinner_stop()

server = context.wbem_server

rows = []
headers = ['Brand', 'Version', 'Interop Namespace', 'Namespaces']
if len(server.namespaces) > 3:
namespaces = '\n'.join(server.namespaces)
else:
namespaces = ', '.join(server.namespaces)
sep = '\n' if namespaces and len(namespaces) > 3 else ', '
namespaces = sep.join(namespaces)

rows.append([server.brand, server.version,
server.interop_ns,
namespaces])
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/pytest_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,14 @@ def wrapper_func(desc, kwargs, exp_exc_types, exp_warn_types, condition):
if exp_exc_types:
with pytest.raises(exp_exc_types):
if condition == 'pdb':
pdb.set_trace()
pdb.set_trace() # pylint: disable=no-member

test_func(testcase, **kwargs) # expecting an exception

ret = None # Debugging hint
else:
if condition == 'pdb':
pdb.set_trace()
pdb.set_trace() # pylint: disable=no-member

test_func(testcase, **kwargs) # not expecting an exception

Expand Down
17 changes: 9 additions & 8 deletions tests/unit/test_profile_cmds.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
# but not tied to the DMTF classes.
SIMPLE_MOCK_FILE = 'simple_mock_model.mof'
INVOKE_METHOD_MOCK_FILE = 'simple_mock_invokemethod.py'

MOCK_SERVER_MODEL = os.path.join('testmock', 'wbemserver_mock.py')

# The following lists define the help for each command in terms of particular
Expand Down Expand Up @@ -135,7 +136,7 @@

['Verify server command profiles',
{'args': ['list'],
'general': ['-d', 'interop', '-o', 'simple']},
'general': ['-o', 'simple']},
{'stdout': ['Advertised management profiles:',
'Organization Registered Name Version',
'-------------- -------------------- ---------',
Expand All @@ -153,7 +154,7 @@

['Verify server command profiles, filtered by org',
{'args': ['list', '-o', 'DMTF'],
'general': ['-d', 'interop', '-o', 'simple']},
'general': ['-o', 'simple']},
{'stdout': ['Advertised management profiles: org=DMTF',
'Organization Registered Name Version',
'-------------- -------------------- ---------',
Expand All @@ -166,7 +167,7 @@

['Verify server command profiles, filtered by org, long',
{'args': ['list', '--organization', 'DMTF'],
'general': ['-d', 'interop', '-o', 'simple']},
'general': ['-o', 'simple']},
{'stdout': ['Advertised management profiles: org=DMTF',
'Organization Registered Name Version',
'-------------- -------------------- ---------',
Expand All @@ -179,7 +180,7 @@

['Verify server command profiles, filtered by org, and name',
{'args': ['list', '--organization', 'DMTF', '--profile', 'Component'],
'general': ['-d', 'interop', '-o', 'plain']},
'general': ['-o', 'plain']},
{'stdout': ['Advertised management profiles: org=DMTF name=Component',
'Organization Registered Name Version',
'DMTF Component 1.4.0'],
Expand All @@ -189,7 +190,7 @@

['Verify server command profiles, filtered by name',
{'args': ['list', '-p', 'Profile Registration'],
'general': ['-d', 'interop', '-o', 'simple']},
'general': ['-o', 'simple']},
{'stdout': ['Advertised management profiles:',
'Organization Registered Name Version',
'-------------- -------------------- ---------',
Expand All @@ -200,7 +201,7 @@

['Verify server command profiles, filtered by org, long',
{'args': ['list', '--profile', 'Profile Registration'],
'general': ['-d', 'interop', '-o', 'simple']},
'general': ['-o', 'simple']},
{'stdout': ['Advertised management profiles:',
'Organization Registered Name Version',
'-------------- -------------------- ---------',
Expand All @@ -212,13 +213,13 @@
['Verify server command centralinsts based on wbem server mock.',
{'args': ['centralinsts', '-o', 'SNIA',
'-p', 'Server'],
'general': ['-d', 'interop', '-o', 'simple']},
'general': ['-o', 'simple']},
{'stdout': ['Advertised Central Instances:',
'Profile',
'Central Instance paths',
'SNIA:Server:1.1.0',
'SNIA:Server:1.2.0',
'interop:MCK_StorageComputerSystem'],
'root/cimv2:MCK_StorageComputerSystem'],
'rc': 0,
'test': 'innows'},
MOCK_SERVER_MODEL, OK],
Expand Down
33 changes: 16 additions & 17 deletions tests/unit/test_server_cmds.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
# but not tied to the DMTF classes.
SIMPLE_MOCK_FILE = 'simple_mock_model.mof'
INVOKE_METHOD_MOCK_FILE = 'simple_mock_invokemethod.py'

MOCK_SERVER_MODEL = os.path.join('testmock', 'wbemserver_mock.py')

# The following lists define the help for each command in terms of particular
Expand Down Expand Up @@ -169,51 +170,49 @@
# Verify the individual commands returning data
#
['Verify server command interop default output',
{'args': ['interop'],
'general': ['-d', 'interop']},
{'args': ['interop'], },
{'stdout': ['interop'],
'rc': 0,
'test': 'innows'},
MOCK_SERVER_MODEL, OK],
MOCK_SERVER_MODEL, RUN],

['Verify server command interop',
{'args': ['interop'],
'general': ['-d', 'interop', '-o', 'text']},
'general': ['-o', 'text']},
{'stdout': ['interop'],
'rc': 0,
'test': 'innows'},
MOCK_SERVER_MODEL, OK],

['Verify server command namespaces',
{'args': ['namespaces'],
'general': ['-d', 'interop', '-o', 'simple']},
'general': ['-o', 'simple']},
{'stdout': ['Server Namespaces:',
'Namespace Name',
'----------------',
'interop'],
'interop',
'root/cimv2'],
'rc': 0,
'test': 'lines'},
MOCK_SERVER_MODEL, OK],

['Verify server command namespaces, text output',
{'args': ['namespaces'],
'general': ['-d', 'interop', '-o', 'text']},
{'stdout': ['interop'],
'general': ['-o', 'text']},
{'stdout': ['interop, root/cimv2'],
'rc': 0,
'test': 'lines'},
MOCK_SERVER_MODEL, OK],

['Verify server command namespaces with sort option',
{'args': ['namespaces'],
'general': ['-d', 'interop']},
{'args': ['namespaces'], },
{'stdout': ['interop'],
'rc': 0,
'test': 'innows'},
MOCK_SERVER_MODEL, OK],

['Verify server command brand',
{'args': ['brand'],
'general': ['-d', 'interop']},
{'args': ['brand'], },
{'stdout': ['OpenPegasus'],
'rc': 0,
'test': 'innows'},
Expand All @@ -222,22 +221,22 @@

['Verify server command brand with --output table fails',
{'args': ['brand'],
'general': ['-d', 'interop', '-o', 'simple']},
'general': ['-o', 'simple']},
{'stderr': ['Output format "simple" not allowed for this command'],
'rc': 1,
'test': 'innows'},
MOCK_SERVER_MODEL, OK],

['Verify server command info with mock server',
{'args': ['info'],
'general': ['-d', 'interop', '-o', 'simple']},
'general': ['-o', 'simple']},
{'stdout':
['Server General Information',
'Brand Version Interop Namespace Namespaces',
'----------- --------- ------------------- ------------',
'OpenPegasus 2.15.0 interop interop'],
'----------- --------- ------------------- -------------------',
'OpenPegasus 2.15.0 interop interop, root/cimv2'],
'rc': 0,
'test': 'lines'},
'test': 'linesnows'},
MOCK_SERVER_MODEL, OK],

#
Expand Down

0 comments on commit 89baba0

Please sign in to comment.