def test_moniker (self): """Look at all possible options for moniker construction and pass them through to a WMI connector """ for computer in COMPUTERS: if computer in (None, "."): local_authorities = [None] else: local_authorities = AUTHORITIES for impersonation_level in IMPERSONATION_LEVELS: for authentication_level in AUTHENTICATION_LEVELS: for authority in local_authorities: for privileges in PRIVILEGES: for namespace in NAMESPACES: moniker = wmi.construct_moniker ( computer=computer, impersonation_level=impersonation_level, authority=authority, privileges=privileges, namespace=namespace ) self.assert_ (wmi.WMI (moniker=moniker), "Moniker failed: %s" % moniker)
def test_moniker_root_namespace (self): "Check that namespace is prefixed by root if needed" self.assertEquals (wmi.construct_moniker (namespace="default"), "winmgmts:root/default") self.assertEquals (wmi.construct_moniker (namespace="root/default"), "winmgmts:root/default")