kopia lustrzana https://github.com/OpenDroneMap/WebODM
Merge pull request #610 from pierotofy/themefix
Fixed theme settings page, added testspull/617/head
commit
3d3c6164f6
|
@ -3,6 +3,8 @@ from django.test import Client
|
||||||
from rest_framework import status
|
from rest_framework import status
|
||||||
|
|
||||||
from app.models import Project, Task
|
from app.models import Project, Task
|
||||||
|
from app.models import Setting
|
||||||
|
from app.models import Theme
|
||||||
from .classes import BootTestCase
|
from .classes import BootTestCase
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
|
|
||||||
|
@ -21,8 +23,6 @@ class TestApp(BootTestCase):
|
||||||
# Add user to test Group
|
# Add user to test Group
|
||||||
User.objects.get(pk=1).groups.add(my_group)
|
User.objects.get(pk=1).groups.add(my_group)
|
||||||
|
|
||||||
def tearDown(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def test_user_login(self):
|
def test_user_login(self):
|
||||||
c = Client()
|
c = Client()
|
||||||
|
@ -69,6 +69,10 @@ class TestApp(BootTestCase):
|
||||||
# We should have a project created from the dashboard
|
# We should have a project created from the dashboard
|
||||||
self.assertTrue(Project.objects.count() >= 1)
|
self.assertTrue(Project.objects.count() >= 1)
|
||||||
|
|
||||||
|
# Can access API page
|
||||||
|
res = c.get('/api/')
|
||||||
|
self.assertTrue(res.status_code == status.HTTP_200_OK)
|
||||||
|
|
||||||
# We can access a processingnode view that exists
|
# We can access a processingnode view that exists
|
||||||
res = c.get('/processingnode/1/')
|
res = c.get('/processingnode/1/')
|
||||||
self.assertTrue(res.status_code == 200)
|
self.assertTrue(res.status_code == 200)
|
||||||
|
@ -143,8 +147,30 @@ class TestApp(BootTestCase):
|
||||||
ac = Client()
|
ac = Client()
|
||||||
test_public_views(ac, status.HTTP_200_OK)
|
test_public_views(ac, status.HTTP_200_OK)
|
||||||
|
|
||||||
|
def test_admin_views(self):
|
||||||
|
c = Client()
|
||||||
|
c.login(username='testsuperuser', password='test1234')
|
||||||
|
|
||||||
|
settingId = Setting.objects.all()[0].id # During tests, sometimes this is != 1
|
||||||
|
themeId = Theme.objects.all()[0].id # During tests, sometimes this is != 1
|
||||||
|
|
||||||
|
# Can access admin menu items
|
||||||
|
admin_menu_items = ['/admin/app/setting/{}/change/'.format(settingId),
|
||||||
|
'/admin/app/theme/{}/change/'.format(themeId),
|
||||||
|
'/admin/',
|
||||||
|
]
|
||||||
|
|
||||||
|
for url in admin_menu_items:
|
||||||
|
res = c.get(url)
|
||||||
|
self.assertEqual(res.status_code, status.HTTP_200_OK)
|
||||||
|
|
||||||
|
# Cannot access admin views as normal user
|
||||||
|
c.logout()
|
||||||
|
c.login(username='testuser', password='test1234')
|
||||||
|
|
||||||
|
for url in admin_menu_items:
|
||||||
|
res = c.get(url, follow=True)
|
||||||
|
self.assertRedirects(res, '/admin/login/?next={}'.format(url))
|
||||||
|
|
||||||
|
|
||||||
def test_default_group(self):
|
def test_default_group(self):
|
||||||
|
|
|
@ -8,7 +8,7 @@ coreapi==2.0.9
|
||||||
Django==2.1.5
|
Django==2.1.5
|
||||||
django-appconf==1.0.2
|
django-appconf==1.0.2
|
||||||
django-codemirror2==0.2
|
django-codemirror2==0.2
|
||||||
django-colorfield==0.1.14
|
django-colorfield==0.1.15
|
||||||
django-compressor==2.2
|
django-compressor==2.2
|
||||||
django-cors-headers==2.2.0
|
django-cors-headers==2.2.0
|
||||||
django-filter==2.0.0
|
django-filter==2.0.0
|
||||||
|
|
Ładowanie…
Reference in New Issue