def testGreeter(self): greeter = Greeter(FakeAdminWindow()) self.failUnless(isinstance(greeter, SimpleWizard)) self.failUnless(isinstance(greeter.name, str)) self.failUnless(isinstance(greeter.page, WizardStep)) self.failUnless(isinstance(greeter.pages, dict)) self.failUnless(isinstance(greeter.page_stack, list)) self.failUnless(isinstance(greeter.state, dict)) self.setWindow(greeter.window) self._checkPrevNext(False, True) self.click('connect_to_existing') self._next() self._prev() # FIXME: Save the last option selected instead of # always selecting the first self.click('connect_to_existing') self._next() self._checkPrevNext(True, True) self.setText('host_entry', 'foolio') self._checkPrevNext(True, True) self.click('ssl_check') self.checkText('port_entry', '8642') self._next() self._prev() self._next() self._checkPrevNext(True, False) self.setText('user_entry', 'bar') self._checkPrevNext(True, False) self.setText('passwd_entry', 'baz') self._checkPrevNext(True, True) self._next() state = greeter.run() self.refreshUI() self.assertEquals(state.get('passwd'), 'baz') self.assertEquals(state.get('host'), 'foolio') self.assertEquals(state.get('port'), 8642) self.assertEquals(state.get('use_insecure'), True) self.assertEquals(state.get('user'), 'bar') self.failUnless('connectionInfo' in state)
def showGreeter(adminWindow): from flumotion.admin.gtk.greeter import Greeter greeter = Greeter(adminWindow) d = greeter.runAsync() return d