mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
Add icons for desktop applications and Apple App store.
- Add yapf style file for consistency of formatting - Some minor changes and renaming - Add template tag filters for checking conditions - Move icons from img directory to icons directory Currently the client listing is in both the SetupView and ServceView for ease of development. Have to remove from ServiceView. Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
1 parent
defcb37472
commit
d3cddfa68c
21 files changed
+382
-272
No files matched your search
@@ -14,18 +14,22 @@
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
"""
|
||||
Test module for custom Django template tags.
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
from plinth.templatetags.plinth_extras import mark_active_menuitem
|
||||
from plinth.modules.syncthing.manifest import clients as syncthing_clients
|
||||
from plinth.modules.infinoted.manifest import clients as infinoted_clients
|
||||
from plinth.modules.deluge.manifest import clients as deluge_clients
|
||||
from plinth.modules.quassel.manifest import clients as quassel_clients
|
||||
from plinth.templatetags import plinth_extras
|
||||
|
||||
|
||||
class TestShowSubSubMenu(unittest.TestCase):
|
||||
"""Verify that the highlighting of the subsubmenu is working correctly"""
|
||||
|
||||
def assert_active_url(self, menu, url):
|
||||
"""Verify that only the given url is set as 'active' in the menu"""
|
||||
for item in menu:
|
||||
@@ -41,19 +45,45 @@ class TestShowSubSubMenu(unittest.TestCase):
|
||||
|
||||
def test_highlighting(self):
|
||||
"""Test detection of active subsubmenu items using request.path"""
|
||||
menu = [{'url': '/abc/123/abc/', 'text': 'abc'},
|
||||
{'url': '/abc/123/', 'text': 'overview'},
|
||||
{'url': '/abc/123/crunch/', 'text': 'crunch'},
|
||||
{'url': '/abc/123/create/', 'text': 'create'}]
|
||||
menu = [{
|
||||
'url': '/abc/123/abc/',
|
||||
'text': 'abc'
|
||||
}, {
|
||||
'url': '/abc/123/',
|
||||
'text': 'overview'
|
||||
}, {
|
||||
'url': '/abc/123/crunch/',
|
||||
'text': 'crunch'
|
||||
}, {
|
||||
'url': '/abc/123/create/',
|
||||
'text': 'create'
|
||||
}]
|
||||
|
||||
tests = [['/abc/123/crunch/new/', '/abc/123/crunch/'],
|
||||
['/abc/123/create/', '/abc/123/create/'],
|
||||
['/abc/123/nolink/', '/abc/123/'],
|
||||
['/abc/123/abx/', '/abc/123/'],
|
||||
['/abc/123/ab/', '/abc/123/'],
|
||||
['/abc/123/', '/abc/123/']]
|
||||
tests = [['/abc/123/crunch/new/', '/abc/123/crunch/'], [
|
||||
'/abc/123/create/', '/abc/123/create/'
|
||||
], ['/abc/123/nolink/', '/abc/123/'], ['/abc/123/abx/', '/abc/123/'],
|
||||
['/abc/123/ab/', '/abc/123/'], ['/abc/123/', '/abc/123/']]
|
||||
|
||||
for check_path, expected_active_path in tests:
|
||||
menu = mark_active_menuitem(menu, check_path)
|
||||
menu = plinth_extras.mark_active_menuitem(menu, check_path)
|
||||
self.assert_active_url(menu, expected_active_path)
|
||||
self.assertTrue(self._verify_active_menuitems(menu))
|
||||
|
||||
def test_has_web_clients(self):
|
||||
"""Test for a utility function that returns
|
||||
whether an application has web clients"""
|
||||
self.assertTrue(plinth_extras.has_web_clients(syncthing_clients))
|
||||
self.assertFalse(plinth_extras.has_web_clients(quassel_clients))
|
||||
|
||||
def test_has_mobile_clients(self):
|
||||
"""Test for a utility function that returns
|
||||
whether an application has mobile clients"""
|
||||
self.assertTrue(plinth_extras.has_mobile_clients(syncthing_clients))
|
||||
self.assertFalse(plinth_extras.has_mobile_clients(infinoted_clients))
|
||||
|
||||
def test_has_desktop_clients(self):
|
||||
"""Test for a utility function that returns
|
||||
whether an application has desktop clients"""
|
||||
self.assertTrue(
|
||||
plinth_extras.has_desktop_clients(syncthing_clients[0]))
|
||||
self.assertFalse(plinth_extras.has_desktop_clients(deluge_clients))
|
||||
Reference in new issue
Block a user