diff --git a/app/tests/test_app.py b/app/tests/test_app.py index a0d9560a..d626dd85 100644 --- a/app/tests/test_app.py +++ b/app/tests/test_app.py @@ -1,6 +1,8 @@ from django.contrib.auth.models import User, Group from django.test import Client from rest_framework import status +from guardian.shortcuts import assign_perm +from nodeodm.models import ProcessingNode from app.models import Project, Task from app.models import Setting @@ -24,6 +26,11 @@ class TestApp(BootTestCase): # Add user to test Group User.objects.get(pk=1).groups.add(my_group) + # Add view permissions + user = User.objects.get(username=self.credentials['username']) + pns = ProcessingNode.objects.all() + for pn in pns: + assign_perm('view_processingnode', user, pn) def test_user_login(self): c = Client() @@ -89,6 +96,18 @@ class TestApp(BootTestCase): self.assertEqual(message.tags, 'warning') self.assertTrue("offline" in message.message) + # The menu should have 3 processing nodes + res = c.get('/dashboard/', follow=True) + self.assertEqual(res.content.decode("utf-8").count('href="/processingnode/'), 3) + self.assertTemplateUsed(res, 'app/dashboard.html') + + # We can change that with a setting + settings.UI_MAX_PROCESSING_NODES = 1 + + res = c.get('/dashboard/', follow=True) + self.assertEqual(res.content.decode("utf-8").count('href="/processingnode/'), 1) + self.assertTemplateUsed(res, 'app/dashboard.html') + res = c.get('/processingnode/9999/') self.assertTrue(res.status_code == 404) diff --git a/app/views/app.py b/app/views/app.py index f37266e2..85fd2a01 100644 --- a/app/views/app.py +++ b/app/views/app.py @@ -109,7 +109,7 @@ def about(request): def processing_node(request, processing_node_id): pn = get_object_or_404(ProcessingNode, pk=processing_node_id) if not pn.update_node_info(): - messages.add_message(request, messages.constants.WARNING, '{} seems to be offline.'.format(pn)) + messages.add_message(request, messages.constants.WARNING, _('%(node)s seems to be offline.') % {'node': pn}) return render(request, 'app/processing_node.html', { diff --git a/webodm/settings.py b/webodm/settings.py index 17fcb486..6538d698 100644 --- a/webodm/settings.py +++ b/webodm/settings.py @@ -391,7 +391,10 @@ CACHES = { # before it should be considered offline NODE_OFFLINE_MINUTES = 5 +# URL to external auth endpoint EXTERNAL_AUTH_ENDPOINT = '' + +# URL to a page where a user can reset the password RESET_PASSWORD_LINK = '' # Number of hours before tasks are automatically deleted