diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 21:38:38 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 21:38:38 +0000 |
commit | 2e2851dc13d73352530dd4495c7e05603b2e520d (patch) | |
tree | 622b9cd8e5d32091c9aa9e4937b533975a40356c /deluge/plugins/Label/deluge_label/test.py | |
parent | Initial commit. (diff) | |
download | deluge-upstream.tar.xz deluge-upstream.zip |
Adding upstream version 2.1.2~dev0+20240219.upstream/2.1.2_dev0+20240219upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'deluge/plugins/Label/deluge_label/test.py')
-rw-r--r-- | deluge/plugins/Label/deluge_label/test.py | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/deluge/plugins/Label/deluge_label/test.py b/deluge/plugins/Label/deluge_label/test.py new file mode 100644 index 0000000..739bae4 --- /dev/null +++ b/deluge/plugins/Label/deluge_label/test.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python +# +# -*- coding: utf-8 -*- +# +# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com> +# +# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with +# the additional special exception to link portions of this program with the OpenSSL library. +# See LICENSE for more details. +# + +from deluge.ui.client import sclient + +sclient.set_core_uri() + +print(sclient.get_enabled_plugins()) + +# enable plugin. +if 'label' not in sclient.get_enabled_plugins(): + sclient.enable_plugin('label') + + +# test labels. +print('#init labels') +try: + sclient.label_remove('test') +except Exception: + pass +sess_id = sclient.get_session_state()[0] + +print('#add') +sclient.label_add('test') +print('#set') +sclient.label_set_torrent(id, 'test') + +print(sclient.get_torrents_status({'label': 'test'}, 'name')) + + +print('#set options') +sclient.label_set_options('test', {'max_download_speed': 999}, True) +print(sclient.get_torrent_status(sess_id, ['max_download_speed']), '999') +sclient.label_set_options('test', {'max_download_speed': 9}, True) +print(sclient.get_torrent_status(sess_id, ['max_download_speed']), '9') +sclient.label_set_options('test', {'max_download_speed': 888}, False) +print(sclient.get_torrent_status(sess_id, ['max_download_speed']), '9 (888)') + +print(sclient.get_torrent_status(sess_id, ['name', 'tracker_host', 'label'])) |