diff --git a/openslides/core/views.py b/openslides/core/views.py index ae1661519..fae55de39 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 @@ -545,21 +545,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 850c0ae3c..ff1ea817d 100644 --- a/tests/integration/core/test_views.py +++ b/tests/integration/core/test_views.py @@ -105,31 +105,14 @@ def test_project_view(client): assert projector.elements_preview == [[{"name": "topics/topic", "id": 3}]] -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):