def setUp(self): self.app = QApplication(sys.argv) self.app.setOrganizationName("GNS3") self.app.setOrganizationDomain("gns3.net") self.app.setApplicationName("Testsuite") self.page = CloudPreferencesPage() # mock settings instance inside the page widget self.page.settings = mock.MagicMock() settings_copy = CLOUD_SETTINGS.copy() self.page.settings.__getitem__.side_effect = make_getitem(settings_copy) self.page.settings.__setitem__.side_effect = make_setitem(settings_copy) self._init_page()
def setUp(self): self.app = QApplication(sys.argv) self.app.setOrganizationName("GNS3") self.app.setOrganizationDomain("gns3.net") self.app.setApplicationName("Testsuite") self.page = CloudPreferencesPage() # mock settings instance inside the page widget self.page.settings = mock.MagicMock() settings_copy = CLOUD_SETTINGS.copy() self.page.settings.__getitem__.side_effect = make_getitem(settings_copy) self.page.settings.__setitem__.side_effect = make_setitem(settings_copy) self._init_page() # RackspaceCtrl mock self.ctrl_mock = mock.MagicMock() self.ctrl_mock.return_value = self.ctrl_mock self.ctrl_mock.authenticate.return_value = True self.ctrl_mock.list_regions.return_value = [{'ORD': 'ord'}, {'SYD': 'syd'}, {'DFW': 'dfw'}, {'HKG': 'hkg'}, {'IAD': 'iad'}]
def _init_page(self): self.page = CloudPreferencesPage() self.page.settings = mock.MagicMock() fake_settings = CLOUD_SETTINGS.copy() self.page.settings.__getitem__.side_effect = make_getitem(fake_settings) self.page.settings.__setitem__.side_effect = make_setitem(fake_settings)