def test_process_object(self): class FakeProcess(object): def __repr__(self): return 'foo' process = FakeProcess() self.assertEqual( "process object = 'foo'", _s._get_search_criteria_string_representation(process=process))
def test_all_parameters_combined(self): class FakeProcess(object): def __repr__(self): return 'foo' process = FakeProcess() observed = _s._get_search_criteria_string_representation( pid=123, dbus_bus='session_bus', connection_name='com.Canonical.Unity', object_path='/com/Canonical/Autopilot', application_name='MyApp', process=process) expected_strings = [ "pid = 123", "dbus bus = 'session_bus'", "connection name = 'com.Canonical.Unity'", "object path = '/com/Canonical/Autopilot'", "application name = 'MyApp'", "process object = 'foo'", ] self.assertThat(observed, MatchesAll(*map(Contains, expected_strings)))
def test_application_name(self): self.assertEqual( "application name = 'foo'", _s._get_search_criteria_string_representation( application_name='foo'))
def test_object_path(self): self.assertEqual( "object path = 'foo'", _s._get_search_criteria_string_representation(object_path='foo'))
def test_dbus_bus(self): self.assertEqual( "dbus bus = 'foo'", _s._get_search_criteria_string_representation(dbus_bus='foo'))
def test_pid(self): self.assertEqual( 'pid = 123', _s._get_search_criteria_string_representation(pid=123))
def test_get_string_rep_defaults_to_empty_string(self): observed = _s._get_search_criteria_string_representation() self.assertEqual("", observed)