forked from gerardpuig/ubuntu-cleaner
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Calling `get_from_name()` with no parameters, should return the pixbuf object through `load_icon()` and default parameters.
- Loading branch information
1 parent
ddcca32
commit 495a356
Showing
2 changed files
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
lxml | ||
coveralls | ||
mock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import unittest | ||
import mock | ||
|
||
from gi.repository import GdkPixbuf | ||
from ubuntucleaner.utils.icon import get_from_name, DEFAULT_SIZE | ||
|
||
|
||
class TestIconModule(unittest.TestCase): | ||
|
||
def test_get_from_name(self): | ||
""" | ||
Calling with no parameters should return the pixbuf object through `load_icon()` | ||
and default parameters. | ||
""" | ||
m_pixbuf = mock.Mock(spec=GdkPixbuf.Pixbuf, get_height=lambda: DEFAULT_SIZE) | ||
with mock.patch("ubuntucleaner.utils.icon.Gtk.IconTheme.load_icon") as m_load_icon: | ||
m_load_icon.return_value = m_pixbuf | ||
pixbuf = get_from_name() | ||
self.assertEqual( | ||
m_load_icon.call_args_list, [mock.call("gtk-execute", 24, 0)] | ||
) | ||
self.assertEqual(pixbuf, m_pixbuf) |