deluge/deluge/tests/test_tracker_icons.py
Calum Lind 3a2ff0c188 [Lint] Convert all python double quotes to single quotes
* A rather disruptive change but for a few reasons such as easier to read,
   easier type, keep consistent and javascript code uses single quotes.
 * There are a few exceptions for the automated process:
    * Any double quotes in comments
    * Triple double quotes for docstrings
    * Strings containing single quotes are left e.g. "they're"

 * To deal with merge conflicts from feature branches it is best to follow
   these steps for each commit:
     * Create a patch: `git format-patch -1 <sha1>`
     * Edit the patch and replace double quotes with single except those in
       comments or strings containing an unescaped apostrophe.
     * Check the patch `git apply --check <patchfile>` and fix any remaining
       issues if it outputs an error.
     * Apply the patch `git am < <patchfile>`
2016-11-03 21:45:45 +00:00

61 lines
1.9 KiB
Python

import pytest
import deluge.component as component
import deluge.ui.tracker_icons
from deluge.ui.tracker_icons import TrackerIcon, TrackerIcons
from . import common
from .basetest import BaseTestCase
common.set_tmp_config_dir()
deluge.ui.tracker_icons.PIL_INSTALLED = False
common.disable_new_release_check()
@pytest.mark.internet
class TrackerIconsTestCase(BaseTestCase):
def set_up(self):
self.icons = TrackerIcons()
def tear_down(self):
return component.shutdown()
def test_get_deluge_png(self):
# Deluge has a png favicon link
icon = TrackerIcon(common.get_test_data_file('deluge.png'))
d = self.icons.fetch('deluge-torrent.org')
d.addCallback(self.assertNotIdentical, None)
d.addCallback(self.assertEquals, icon)
return d
def test_get_google_ico(self):
# Google doesn't have any icon links
# So instead we'll grab its favicon.ico
icon = TrackerIcon(common.get_test_data_file('google.ico'))
d = self.icons.fetch('www.google.com')
d.addCallback(self.assertNotIdentical, None)
d.addCallback(self.assertEquals, icon)
return d
def test_get_google_ico_with_redirect(self):
# google.com redirects to www.google.com
icon = TrackerIcon(common.get_test_data_file('google.ico'))
d = self.icons.fetch('google.com')
d.addCallback(self.assertNotIdentical, None)
d.addCallback(self.assertEquals, icon)
return d
def test_get_ubuntu_ico(self):
# ubuntu.com has inline css which causes HTMLParser issues
icon = TrackerIcon(common.get_test_data_file('ubuntu.png'))
d = self.icons.fetch('www.ubuntu.com')
d.addCallback(self.assertNotIdentical, None)
d.addCallback(self.assertEquals, icon)
return d
def test_get_empty_string_tracker(self):
d = self.icons.fetch('')
d.addCallback(self.assertIdentical, None)
return d