diff --git a/openslides/core/views.py b/openslides/core/views.py index 2270f1e88..d925f55d4 100644 --- a/openslides/core/views.py +++ b/openslides/core/views.py @@ -1,6 +1,6 @@ import datetime import os -from typing import Any, Dict, List +from typing import Any, Dict from django.conf import settings from django.contrib.staticfiles import finders @@ -10,9 +10,9 @@ from django.http import Http404, HttpResponse from django.utils.timezone import now from django.views import static from django.views.generic.base import View -from mypy_extensions import TypedDict from .. import __license__ as license, __url__ as url, __version__ as version +from ..users.models import User from ..utils import views as utils_views from ..utils.arguments import arguments from ..utils.auth import GROUP_ADMIN_PK, anonymous_is_enabled, has_perm, in_some_groups @@ -512,21 +512,13 @@ class VersionView(utils_views.APIView): http_method_names = ["get"] def get_context_data(self, **context): - Result = TypedDict( - "Result", - { - "openslides_version": str, - "openslides_license": str, - "openslides_url": str, - "plugins": List[Dict[str, str]], - }, - ) - result: Result = dict( - openslides_version=version, - openslides_license=license, - openslides_url=url, - plugins=[], - ) + result: Dict[str, Any] = { + "openslides_version": version, + "openslides_license": license, + "openslides_url": url, + "plugins": [], + "no_name_yet_users": User.objects.filter(last_login__isnull=False).count(), + } # Versions of plugins. for plugin in settings.INSTALLED_PLUGINS: result["plugins"].append( diff --git a/openslides/utils/settings.py.tpl b/openslides/utils/settings.py.tpl index 092fbb874..7d20f5347 100644 --- a/openslides/utils/settings.py.tpl +++ b/openslides/utils/settings.py.tpl @@ -114,6 +114,7 @@ if use_redis: 'host': '127.0.0.1', 'post': 6379, 'db': 0, + "prefix": "session" } diff --git a/tests/integration/core/test_views.py b/tests/integration/core/test_views.py index a9d7cf6f3..50ba82349 100644 --- a/tests/integration/core/test_views.py +++ b/tests/integration/core/test_views.py @@ -1,5 +1,6 @@ import json +import pytest from django.urls import reverse from rest_framework import status from rest_framework.test import APIClient @@ -68,31 +69,14 @@ class ProjectorAPI(TestCase): self.assertEqual(response.status_code, 400) -class VersionView(TestCase): - """ - Tests the version info view. - """ - - def test_get(self): - self.client.login(username="admin", password="admin") - response = self.client.get(reverse("core_version")) - self.assertEqual( - json.loads(response.content.decode()), - { - "openslides_version": version, - "openslides_license": license, - "openslides_url": url, - "plugins": [ - { - "verbose_name": "OpenSlides Test Plugin", - "description": "This is a test plugin for OpenSlides.", - "version": "unknown", - "license": "MIT", - "url": "", - } - ], - }, - ) +@pytest.mark.django_db(transaction=False) +def test_get(client): + client.login(username="admin", password="admin") + response = client.get(reverse("core_version")) + values = json.loads(response.content.decode()) + assert values["openslides_version"] == version + assert values["openslides_license"] == license + assert values["openslides_url"] == url class ConfigViewSet(TestCase):