Added tests for custom menu and dashboard media
This commit is contained in:
parent
5bda74f00b
commit
6891e59fc3
|
@ -12,6 +12,12 @@ class CustomIndexDashboard(Dashboard):
|
|||
"""
|
||||
Custom index dashboard for test_proj.
|
||||
"""
|
||||
class Media:
|
||||
css = {
|
||||
'all': ('test_app/dashboard.css',),
|
||||
}
|
||||
js = ('test_app/dashboard.js',)
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
Dashboard.__init__(self, **kwargs)
|
||||
|
||||
|
|
|
@ -10,6 +10,12 @@ class CustomMenu(Menu):
|
|||
"""
|
||||
Custom Menu for test_proj admin site.
|
||||
"""
|
||||
class Media:
|
||||
css = {
|
||||
'all': ('test_app/menu.css',),
|
||||
}
|
||||
js = ('test_app/menu.js',)
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
Menu.__init__(self, **kwargs)
|
||||
self.children += [
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
/* dummy file for testing purpose */
|
|
@ -0,0 +1 @@
|
|||
// dummy file for testing purpose
|
|
@ -0,0 +1 @@
|
|||
/* dummy file for testing purpose */
|
|
@ -0,0 +1 @@
|
|||
// dummy file for testing purpose
|
|
@ -13,6 +13,21 @@ class AdminBasicTest(TestCase):
|
|||
self.assertEqual(response.status_code, 200)
|
||||
self.client.logout()
|
||||
|
||||
|
||||
def test_custom_menu_media(self):
|
||||
self.client.login(username='superuser', password='123')
|
||||
response = self.client.get('/admin/')
|
||||
self.assertContains(response, '<link rel="stylesheet" href="/static/test_app/menu.css" type="text/css" media="all"/>')
|
||||
self.assertContains(response, '/static/test_app/menu.js')
|
||||
self.client.logout()
|
||||
|
||||
def test_custom_dashboard_media(self):
|
||||
self.client.login(username='superuser', password='123')
|
||||
response = self.client.get('/admin/')
|
||||
self.assertContains(response, '<link rel="stylesheet" href="/static/test_app/dashboard.css" type="text/css" media="all"/>')
|
||||
self.assertContains(response, '/static/test_app/dashboard.js')
|
||||
self.client.logout()
|
||||
|
||||
def test_permissions(self):
|
||||
self.client.login(username='staff', password='123')
|
||||
index = self.client.get('/admin/')
|
||||
|
|
Loading…
Reference in New Issue