def testConvertToEncrypted(self): """ Test the widget to encrypted conversion """ w = QgsAuthSettingsWidget(None, None, 'username', 'password') self.assertEqual(w.username(), 'username') self.assertEqual(w.password(), 'password') self.assertEqual(w.configId(), '') self.assertEqual(w.currentTabIndex(), 1) self.assertTrue(w.btnConvertToEncryptedIsEnabled()) self.assertTrue(w.convertToEncrypted()) self.assertNotEqual(w.configId(), '') self.assertEqual(w.username(), '') self.assertEqual(w.password(), '') self.assertEqual(w.currentTabIndex(), 0) self.assertFalse(w.btnConvertToEncryptedIsEnabled())
def testWidgetUsername(self): """ Test the widget with username only """ w = QgsAuthSettingsWidget(None, None, 'username') self.assertEqual(w.username(), 'username') self.assertEqual(w.password(), '') self.assertEqual(w.configId(), '') self.assertEqual(w.currentTabIndex(), 1)
def testWidgetConfigId(self): """ Test the widget with configId """ w = QgsAuthSettingsWidget(None, self.auth_config.id()) self.assertEqual(w.username(), '') self.assertEqual(w.password(), '') self.assertEqual(w.configId(), self.auth_config.id()) self.assertEqual(w.currentTabIndex(), 0) self.assertFalse(w.btnConvertToEncryptedIsEnabled())
def testWidgetNoArgs(self): """ Test the widget with no args """ w = QgsAuthSettingsWidget() self.assertEqual(w.username(), '') self.assertEqual(w.password(), '') self.assertEqual(w.configId(), '') self.assertEqual(w.currentTabIndex(), 0) self.assertFalse(w.btnConvertToEncryptedIsEnabled())
def testWidgetUsernameAndPassword(self): """ Test the widget with username and password """ w = QgsAuthSettingsWidget(None, None, 'username', 'password') self.assertEqual(w.username(), 'username') self.assertEqual(w.password(), 'password') self.assertEqual(w.configId(), '') self.assertEqual(w.currentTabIndex(), 1) self.assertTrue(w.btnConvertToEncryptedIsEnabled())