Пример #1
0
    def test_setters(self):
        """
        Test setters
        """
        w = QgsAuthSettingsWidget()
        w.setUsername('username')
        self.assertFalse(w.configurationTabIsSelected())
        self.assertEqual(w.username(), 'username')

        w = QgsAuthSettingsWidget()
        w.setPassword('password')
        self.assertEqual(w.password(), 'password')
        self.assertFalse(w.configurationTabIsSelected())

        w = QgsAuthSettingsWidget()
        w.setConfigId(self.auth_config.id())
        self.assertEqual(w.configId(), self.auth_config.id())
        self.assertTrue(w.configurationTabIsSelected())

        w = QgsAuthSettingsWidget()
        w.setUsername('username')
        w.setPassword('password')
        w.setConfigId(self.auth_config.id())
        self.assertEqual(w.configId(), self.auth_config.id())
        self.assertTrue(w.configurationTabIsSelected())

        w = QgsAuthSettingsWidget()
        w.setDataprovider('db2')
        self.assertEqual(w.dataprovider(), 'db2')
Пример #2
0
 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.assertFalse(w.configurationTabIsSelected())
     self.assertTrue(w.btnConvertToEncryptedIsEnabled())
     self.assertTrue(w.convertToEncrypted())
     self.assertNotEqual(w.configId(), '')
     self.assertEqual(w.username(), '')
     self.assertEqual(w.password(), '')
     self.assertTrue(w.configurationTabIsSelected())
     self.assertFalse(w.btnConvertToEncryptedIsEnabled())
Пример #3
0
 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.assertFalse(w.configurationTabIsSelected())
Пример #4
0
 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.assertTrue(w.configurationTabIsSelected())
     self.assertFalse(w.btnConvertToEncryptedIsEnabled())
Пример #5
0
 def testWidgetNoArgs(self):
     """
     Test the widget with no args
     """
     w = QgsAuthSettingsWidget()
     self.assertEqual(w.username(), '')
     self.assertEqual(w.password(), '')
     self.assertEqual(w.configId(), '')
     self.assertTrue(w.configurationTabIsSelected())
     self.assertFalse(w.btnConvertToEncryptedIsEnabled())
Пример #6
0
 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.assertFalse(w.configurationTabIsSelected())
     self.assertTrue(w.btnConvertToEncryptedIsEnabled())
Пример #7
0
 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.assertTrue(w.configurationTabIsSelected())
     self.assertFalse(w.btnConvertToEncryptedIsEnabled())
Пример #8
0
 def testWidgetNoArgs(self):
     """
     Test the widget with no args
     """
     w = QgsAuthSettingsWidget()
     self.assertEqual(w.username(), '')
     self.assertEqual(w.password(), '')
     self.assertEqual(w.configId(), '')
     self.assertTrue(w.configurationTabIsSelected())
     self.assertFalse(w.btnConvertToEncryptedIsEnabled())