예제 #1
0
 def test_find_torrent_failed(self, get_mock):
     response = Response()
     response._content = b"<html><div id=''token'' style=''display:none;''>FKWBGjUDYXGNX7I-UBo5-UiWK1MUOaDmjjrorxOTzmEq3b0lWpr4no8v-FYAAAAA</div></html>"
     get_mock.return_value = response
     plugin = UTorrentClientPlugin()
     torrent_hash = "8347DD6415598A7409DFC3D1AB95078F959BFB93"
     settings = {'host': self.real_host, 'port': self.real_port, 'username': self.real_login,
                 'password': self.real_password}
     plugin.set_settings(settings)
     with pytest.raises(Exception) as e:
         plugin.find_torrent(torrent_hash)
예제 #2
0
 def test_find_torrent(self):
     plugin = UTorrentClientPlugin()
     torrent_hash = "8347DD6415598A7409DFC3D1AB95078F959BFB93"
     settings = {'host': self.real_host, 'username': self.real_login,
                 'password': self.real_password}
     plugin.set_settings(settings)
     torrent = plugin.find_torrent(torrent_hash)
     self.assertIsNone(torrent['date_added'])
     self.assertIsNotNone(torrent['name'])
예제 #3
0
 def test_find_torrent(self):
     plugin = UTorrentClientPlugin()
     torrent_hash = "8347DD6415598A7409DFC3D1AB95078F959BFB93"
     settings = {'host': self.real_host, 'username': self.real_login,
                 'password': self.real_password}
     plugin.set_settings(settings)
     torrent = plugin.find_torrent(torrent_hash)
     self.assertIsNone(torrent['date_added'])
     self.assertIsNotNone(torrent['name'])
예제 #4
0
 def test_find_torrent_failed(self, get_mock):
     response = Response()
     response._content = b"<html><div id=''token'' style=''display:none;''>FKWBGjUDYXGNX7I-UBo5-UiWK1MUOaDmjjrorxOTzmEq3b0lWpr4no8v-FYAAAAA</div></html>"
     get_mock.return_value = response
     plugin = UTorrentClientPlugin()
     torrent_hash = "8347DD6415598A7409DFC3D1AB95078F959BFB93"
     settings = {'host': self.real_host, 'port': self.real_port, 'username': self.real_login,
                 'password': self.real_password}
     plugin.set_settings(settings)
     torrent = plugin.find_torrent(torrent_hash)
     self.assertFalse(torrent)
예제 #5
0
    def test_find_torrent_no_settings(self):
        import monitorrent.plugins.clients.utorrent

        with patch.object(monitorrent.plugins.clients.utorrent.requests.Session, 'get', side_effect=Exception):
            plugin = UTorrentClientPlugin()
            torrent_hash = "8347DD6415598A7409DFC3D1AB95078F959BFB93"
            settings = {'host': self.bad_host, 'port': self.bad_port, 'username': self.bad_login,
                        'password': self.bad_password}
            plugin.set_settings(settings)
            torrent = plugin.find_torrent(torrent_hash)
            self.assertFalse(torrent)
예제 #6
0
    def test_find_torrent_no_settings(self):
        import monitorrent.plugins.clients.utorrent

        with patch.object(monitorrent.plugins.clients.utorrent.requests.Session, 'get', side_effect=Exception):
            plugin = UTorrentClientPlugin()
            torrent_hash = "8347DD6415598A7409DFC3D1AB95078F959BFB93"
            settings = {'host': self.bad_host, 'port': self.bad_port, 'username': self.bad_login,
                        'password': self.bad_password}
            plugin.set_settings(settings)
            torrent = plugin.find_torrent(torrent_hash)
            self.assertFalse(torrent)