def test_one_wmi_connection_at_a_time(self): """ Only use one WMI connection at a time. """ wmi_sampler = WMISampler("Win32_PerfRawData_PerfOS_System", ["ProcessorQueueLength"], host="myhost", namespace="some/namespace", username="******", password="******") # Create a new connection and release it with wmi_sampler.get_connection(): pass self.assertWMIConn(wmi_sampler, count=1) # Refetch the existing connection with wmi_sampler.get_connection(): # No connection is available, create a new one self.assertWMIConn(wmi_sampler, count=0) with wmi_sampler.get_connection(): pass # Two connections are now available self.assertWMIConn(wmi_sampler, count=2)
def test_one_wmi_connection_at_a_time(self): """ Only use one WMI connection at a time. """ wmi_sampler = WMISampler( "Win32_PerfRawData_PerfOS_System", ["ProcessorQueueLength"], host="myhost", namespace="some/namespace", username="******", password="******" ) # Create a new connection and release it with wmi_sampler.get_connection(): pass self.assertWMIConn(wmi_sampler, count=1) # Refetch the existing connection with wmi_sampler.get_connection(): # No connection is available, create a new one self.assertWMIConn(wmi_sampler, count=0) with wmi_sampler.get_connection(): pass # Two connections are now available self.assertWMIConn(wmi_sampler, count=2)
def test_wmi_connection(self): """ Establish a WMI connection to the specified host/namespace, with the right credentials. """ wmi_sampler = WMISampler("Win32_PerfRawData_PerfOS_System", ["ProcessorQueueLength"], host="myhost", namespace="some/namespace", username="******", password="******") # Request a connection but do nothing wmi_sampler.get_connection() # Connection was established with the right parameters self.assertWMIConn(wmi_sampler, param="myhost") self.assertWMIConn(wmi_sampler, param="some/namespace")
def test_wmi_connection(self): """ Establish a WMI connection to the specified host/namespace, with the right credentials. """ wmi_sampler = WMISampler( "Win32_PerfRawData_PerfOS_System", ["ProcessorQueueLength"], host="myhost", namespace="some/namespace", username="******", password="******", ) # Request a connection but do nothing wmi_sampler.get_connection() # Connection was established with the right parameters self.assertWMIConn(wmi_sampler, param="myhost") self.assertWMIConn(wmi_sampler, param="some/namespace")