~jseutter/landscape-client/invalid-integer

« back to all changes in this revision

Viewing changes to landscape/ui/view/tests/test_configuration.py

Merged ui-permissions-and-panel [r=therve,free.ekanayaka][f=911665]

The following changes have been made:
  - Split Configuration model into a DBus service mechanism and a proxy for the client.
  - Split Registration model in to a DBus service mechanism and a proxy for the client (with asynchronous registration).
  - Create PolicyKit policies for configuration and registration and cause these to be checked by the relevant DBus service mechanism when it receives dbus calls (effectively trigger a challenge for a password and only allow admin users to continue).
   - Create DBus service and conf files for the two service mechanisms (Allowing them to be run by the System bus on demand)
   - Create an application desktop file causing the landscape-client-settings-ui program to be launchable from gnome-control-center
   - Create the icon preferences-management-service.svg to represent this activity in gnome-control-center.
   - Create setupui.py - a distutils script for the settings-ui components.

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
        self.assertTrue(dialog._registration_button.get_sensitive())
58
58
        start, end = dialog._registration_textbuffer.get_bounds()
59
59
        self.assertEqual(
 
60
            0,
60
61
            len(dialog._registration_textbuffer.get_text(
61
 
                    start, end, include_hidden_chars=True)),
62
 
            0)
 
62
                    start, end, include_hidden_chars=True)))
63
63
 
64
64
    def test_toggle_radio_button(self):
65
65
        """
93
93
        """
94
94
        controller = ConfigController(self.config)
95
95
        dialog = ClientSettingsDialog(controller)
96
 
        self.assertEqual(dialog._account_entry.get_text(), "foo")
97
 
        self.assertEqual(dialog._password_entry.get_text(), "bar")
98
 
        self.assertEqual(dialog._server_host_name_entry.get_text(),
99
 
                         "landscape.canonical.com")
 
96
        self.assertEqual("foo", dialog._account_entry.get_text())
 
97
        self.assertEqual("bar", dialog._password_entry.get_text())
 
98
        self.assertEqual("landscape.canonical.com",
 
99
                         dialog._server_host_name_entry.get_text())
100
100
 
101
101
    def test_modification(self):
102
102
        """
105
105
        """
106
106
        controller = ConfigController(self.config)
107
107
        dialog = ClientSettingsDialog(controller)
108
 
        self.assertEqual(dialog._registration_image.get_stock(),
109
 
                         (Gtk.STOCK_DISCONNECT, 4))
 
108
        self.assertEqual((Gtk.STOCK_DISCONNECT, 4),
 
109
                         dialog._registration_image.get_stock())
110
110
        dialog._registration_image.set_from_stock(Gtk.STOCK_CONNECT, 4)
111
111
        while Gtk.events_pending():
112
112
            Gtk.main_iteration()
113
 
        self.assertEqual(dialog._registration_image.get_stock(),
114
 
                         (Gtk.STOCK_CONNECT, 4))
 
113
        self.assertEqual((Gtk.STOCK_CONNECT, 4),
 
114
                         dialog._registration_image.get_stock())
115
115
        dialog._account_entry.set_text("Spangles!")
116
116
        while Gtk.events_pending():
117
117
            Gtk.main_iteration()
118
 
        self.assertEqual(dialog._registration_image.get_stock(),
119
 
                         (Gtk.STOCK_DISCONNECT, 4))
 
118
        self.assertEqual((Gtk.STOCK_DISCONNECT, 4),
 
119
                         dialog._registration_image.get_stock())
120
120
        self.assertFalse(dialog._close_button.get_sensitive())
121
121
 
122
122
    def test_revert(self):
125
125
        """
126
126
        controller = ConfigController(self.config)
127
127
        dialog = ClientSettingsDialog(controller)
128
 
        self.assertEqual(dialog._account_entry.get_text(), "foo")
129
 
        self.assertEqual(dialog._password_entry.get_text(), "bar")
130
 
        self.assertEqual(dialog._server_host_name_entry.get_text(),
131
 
                         "landscape.canonical.com")
 
128
        self.assertEqual("foo", dialog._account_entry.get_text())
 
129
        self.assertEqual("bar", dialog._password_entry.get_text())
 
130
        self.assertEqual("landscape.canonical.com",
 
131
                         dialog._server_host_name_entry.get_text())
132
132
        dialog._dedicated_radiobutton.set_active(True)
133
133
        dialog._server_host_name_entry.set_text("more.barn")
134
 
        self.assertEqual(dialog._account_entry.get_text(), "standalone")
135
 
        self.assertEqual(dialog._password_entry.get_text(), "bar")
136
 
        self.assertEqual(dialog._server_host_name_entry.get_text(),
137
 
                         "more.barn")
 
134
        self.assertEqual("standalone", dialog._account_entry.get_text())
 
135
        self.assertEqual("bar", dialog._password_entry.get_text())
 
136
        self.assertEqual("more.barn",
 
137
                         dialog._server_host_name_entry.get_text())
138
138
        self.assertTrue(dialog._dedicated_radiobutton.get_active())
139
139
        self.assertFalse(dialog._hosted_radiobutton.get_active())
140
140
        dialog.revert(None)
141
 
        self.assertEqual(dialog._account_entry.get_text(), "foo")
142
 
        self.assertEqual(dialog._password_entry.get_text(), "bar")
143
 
        self.assertEqual(dialog._server_host_name_entry.get_text(),
144
 
                         "landscape.canonical.com")
 
141
        self.assertEqual("foo", dialog._account_entry.get_text())
 
142
        self.assertEqual("bar", dialog._password_entry.get_text())
 
143
        self.assertEqual("landscape.canonical.com",
 
144
                         dialog._server_host_name_entry.get_text())
145
145
        self.assertFalse(dialog._dedicated_radiobutton.get_active())
146
146
        self.assertTrue(dialog._hosted_radiobutton.get_active())
147
147
 
290
290
        """
291
291
        controller = ConfigController(self.config)
292
292
        dialog = ClientSettingsDialog(controller)
293
 
        self.assertEqual(dialog._account_entry.get_text(), "")
294
 
        self.assertEqual(dialog._password_entry.get_text(), "")
295
 
        self.assertEqual(dialog._server_host_name_entry.get_text(),
296
 
                         "landscape.localdomain")
 
293
        self.assertEqual("", dialog._account_entry.get_text())
 
294
        self.assertEqual("", dialog._password_entry.get_text())
 
295
        self.assertEqual("landscape.localdomain",
 
296
                         dialog._server_host_name_entry.get_text())
297
297
 
298
298
    if not got_gobject_introspection:
299
299
        test_load_data_from_config.skip = gobject_skip_message