Пример #1
0
    def test_check_connection_failed(self, qbittorrent_client):
        qbittorrent_client.side_effect = qbittorrentapi.APIConnectionError

        plugin = QBittorrentClientPlugin()
        settings = self.DEFAULT_SETTINGS
        plugin.set_settings(settings)

        with pytest.raises(qbittorrentapi.APIConnectionError) as e:
            plugin.check_connection()

        qbittorrent_client.assert_called_with(host=QBittorrentClientPlugin.ADDRESS_FORMAT.format('localhost', QBittorrentClientPlugin.DEFAULT_PORT),
                                               username='******', password='******')
Пример #2
0
    def test_check_connection_successfull(self, qbittorrent_client):
        plugin = QBittorrentClientPlugin()
        settings = self.DEFAULT_SETTINGS
        plugin.set_settings(settings)

        self.assertNotEqual(False, plugin.check_connection())

        qbittorrent_client.assert_called_with(host=QBittorrentClientPlugin.ADDRESS_FORMAT.format('localhost', QBittorrentClientPlugin.DEFAULT_PORT),
                                               username='******', password='******')
Пример #3
0
 def test_check_connection_successfull(self):
     plugin = QBittorrentClientPlugin()
     settings = {
         'host': self.real_host,
         'port': self.real_port,
         'username': self.real_login,
         'password': self.real_password
     }
     plugin.set_settings(settings)
     self.assertTrue(plugin.check_connection())
Пример #4
0
    def test_check_connection_failed(self, post_mock):
        response = Response()
        response.status_code = 404
        post_mock.return_value = response

        plugin = QBittorrentClientPlugin()
        self.password_ = {'host': self.bad_host, 'port': self.bad_port, 'username': self.bad_login,
                          'password': self.bad_password}
        settings = self.password_
        plugin.set_settings(settings)
        self.assertFalse(plugin.check_connection())
Пример #5
0
    def test_check_connection_failed(self, post_mock):
        response = Response()
        response.status_code = 404
        post_mock.return_value = response

        plugin = QBittorrentClientPlugin()
        self.password_ = {
            'host': self.bad_host,
            'port': self.bad_port,
            'username': self.bad_login,
            'password': self.bad_password
        }
        settings = self.password_
        plugin.set_settings(settings)
        self.assertFalse(plugin.check_connection())
Пример #6
0
 def test_check_connection_successfull(self):
     plugin = QBittorrentClientPlugin()
     settings = {'host': self.real_host, 'port': self.real_port, 'username': self.real_login,
                 'password': self.real_password}
     plugin.set_settings(settings)
     self.assertTrue(plugin.check_connection())