예제 #1
0
    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))
예제 #2
0
    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)))
예제 #3
0
 def test_application_name(self):
     self.assertEqual(
         "application name = 'foo'",
         _s._get_search_criteria_string_representation(
             application_name='foo'))
예제 #4
0
 def test_object_path(self):
     self.assertEqual(
         "object path = 'foo'",
         _s._get_search_criteria_string_representation(object_path='foo'))
예제 #5
0
 def test_dbus_bus(self):
     self.assertEqual(
         "dbus bus = 'foo'",
         _s._get_search_criteria_string_representation(dbus_bus='foo'))
예제 #6
0
 def test_pid(self):
     self.assertEqual(
         'pid = 123',
         _s._get_search_criteria_string_representation(pid=123))
예제 #7
0
 def test_get_string_rep_defaults_to_empty_string(self):
     observed = _s._get_search_criteria_string_representation()
     self.assertEqual("", observed)