From bcbf88b7f5f1c0a54cf14d03371c38ac3c2ae013 Mon Sep 17 00:00:00 2001 From: Kari Salminen Date: Mon, 23 Sep 2024 18:09:58 +0300 Subject: [PATCH] feat: upgrade all dependencies, PostgreSQL 10->13, use ruff Done: - Upgrade all dependencies - Upgrade postgresql from v10 to v13 (v13 is used in production) - Use ruff instead of black/isort/flake8, remove noqa's, reformat - Use pyproject.toml instead of setup.cfg Background for @map_enums_to_values_in_kwargs decorator: Graphene 3 changed from using enum values to enums, for example: ```python class TestEnum(graphene.Enum): FIRST = 'first' SECOND = 'second' ``` would've been serialized previously using the enum values, i.e. 'first' and 'second'. But with Graphene 3 they are serialized as 'TestEnum.FIRST' and 'TestEnum.SECOND'. This broke functionality as parts of the codebase were expecting the enum values as per Graphene 2. Forced backwards compatibility by forcefully mapping enums to their values. Related https://github.com/graphql-python/graphene issues & PRs: - "Improve enum compatibility" PR: - https://github.com/graphql-python/graphene/pull/1153 - "graphene3: enum doesn't resolve to value" issue: - https://github.com/graphql-python/graphene/issues/1277 - "I would like my enum input values to be the enum instance instead of the enum values" issue: - https://github.com/graphql-python/graphene/issues/1151 See https://github.com/graphql-python/graphene/wiki/v3-release-notes for Graphene v3's breaking changes, refs PT-1730 --- .pre-commit-config.yaml | 30 +- README.md | 19 +- common/mixins.py | 23 + common/models.py | 32 +- common/notification_service.py | 1 + common/tests/conftest.py | 5 +- common/tests/test_utils.py | 254 + common/utils.py | 51 +- docker-compose.yml | 4 +- gdpr/models.py | 3 +- gdpr/service.py | 3 +- gdpr/tests/conftest.py | 1 + gdpr/tests/snapshots/snap_test_gdpr_api.py | 1006 ++-- gdpr/tests/test_gdpr_api.py | 5 +- graphene_linked_events/rest_client.py | 2 +- graphene_linked_events/schema.py | 24 +- graphene_linked_events/tests/test_api.py | 31 +- graphene_linked_events/tests/test_utils.py | 1 + graphene_linked_events/tests/utils.py | 1 + graphene_linked_events/utils.py | 3 +- manage.py | 1 + notification_importers/admin.py | 2 +- .../notification_importer.py | 13 +- ...test_notification_google_sheet_importer.py | 6 +- .../snap_test_notification_importer.py | 6 +- notification_importers/tests/test_commands.py | 3 +- ...test_notification_google_sheet_importer.py | 7 +- occurrences/event_api_services.py | 25 +- occurrences/factories.py | 15 +- occurrences/filters.py | 6 +- ...retention_period_exceeding_contact_info.py | 5 +- occurrences/models.py | 36 +- occurrences/notification_services.py | 3 +- occurrences/schema.py | 46 +- occurrences/schema_services.py | 13 +- occurrences/signals.py | 1 + .../tests/notification_template_fixtures.py | 1 + occurrences/tests/snapshots/snap_test_api.py | 4515 +++++++++-------- .../snapshots/snap_test_notifications.py | 335 +- occurrences/tests/test_api.py | 14 +- occurrences/tests/test_commands.py | 3 +- occurrences/tests/test_event_api_services.py | 5 +- occurrences/tests/test_models.py | 14 +- occurrences/tests/test_notifications.py | 5 +- occurrences/tests/test_signals.py | 3 +- organisations/admin.py | 7 +- organisations/factories.py | 6 +- organisations/schema.py | 15 +- organisations/services.py | 3 +- .../tests/snapshots/snap_test_api.py | 110 +- .../snapshots/snap_test_notifications.py | 16 +- organisations/tests/test_admin.py | 3 +- organisations/tests/test_api.py | 26 +- palvelutarjotin/schema.py | 3 +- palvelutarjotin/settings.py | 6 +- palvelutarjotin/tests/test_oidc.py | 3 +- palvelutarjotin/urls.py | 1 + palvelutarjotin/wsgi.py | 1 + pyproject.toml | 40 + release-please-config.json | 3 +- reports/admin.py | 1 + reports/factories.py | 1 + .../commands/sync_enrolment_reports.py | 1 + reports/models.py | 3 +- reports/serializers.py | 12 +- reports/services.py | 3 +- reports/tests/test_commands.py | 3 +- reports/tests/test_models.py | 3 +- reports/tests/test_views.py | 7 +- reports/views.py | 10 +- requirements-dev.in | 4 +- requirements-dev.txt | 123 +- requirements-prod.txt | 4 +- requirements.in | 20 +- requirements.txt | 128 +- servicemap/rest_client.py | 9 +- setup.cfg | 29 - verification_token/factories.py | 2 + verification_token/models.py | 3 +- verification_token/tests/test_models.py | 3 +- 80 files changed, 4205 insertions(+), 2989 deletions(-) create mode 100644 common/mixins.py create mode 100644 common/tests/test_utils.py create mode 100644 pyproject.toml delete mode 100644 setup.cfg diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9e8ea749..1e71937c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,16 +1,18 @@ -# See https://pre-commit.com for more information -# See https://pre-commit.com/hooks.html for more hooks +# Pre-commit hook documentation: +# - https://pre-commit.com/ +# - https://pre-commit.com/hooks.html +# +# Ruff pre-commit hook documentation: +# - https://github.com/astral-sh/ruff-pre-commit +default_language_version: + python: python3.11 repos: - - repo: https://github.com/PyCQA/isort - rev: 5.12.0 + - repo: https://github.com/astral-sh/ruff-pre-commit + # Ruff version + rev: v0.6.9 hooks: - - id: isort - - repo: https://github.com/psf/black - rev: 23.3.0 - hooks: - - id: black - - repo: https://github.com/PyCQA/flake8 - rev: 6.0.0 - hooks: - - id: flake8 - exclude: migrations|snapshots \ No newline at end of file + # Run the linter + - id: ruff + args: [ --fix ] + # Run the formatter + - id: ruff-format diff --git a/README.md b/README.md index 66c87a48..70d64b70 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ The project is now running at http://localhost:8081 Prerequisites: -- PostgreSQL 10 +- PostgreSQL 13 - Python 3.11 Steps: @@ -253,11 +253,20 @@ To view the API documentation, in DEBUG mode visit http://localhost:8081/graphql ## Code format -This project uses [`black`](https://github.com/ambv/black) for Python code formatting. -We follow the basic config, without any modifications. Basic `black` commands: +This project uses [ruff](https://github.com/astral-sh/ruff) for Python code linting and formatting. +Ruff is configured through [pyproject.toml](./pyproject.toml). +Basic `ruff` commands: -- To let `black` do its magic: `black .` -- To see which files `black` would change: `black --check .` +- Check linting: `ruff check` or `ruff check --fix` to auto-fix +- Check & auto-fix linting: `ruff check --fix` +- Format: `ruff format` + +Basically: + - Ruff linter (i.e. `ruff check --fix`) does what `flake8` and `isort` did before. + - Ruff formatter (i.e. `ruff format`) does what `black` did before. + +Integrations for `ruff` are available for many editors: + - https://docs.astral.sh/ruff/integrations/ Or you can use [`pre-commit`](https://pre-commit.com/) to quickly format your code before committing. diff --git a/common/mixins.py b/common/mixins.py new file mode 100644 index 00000000..27153fa4 --- /dev/null +++ b/common/mixins.py @@ -0,0 +1,23 @@ +class SaveAfterPostGenerationMixin: + """ + Mixin for saving Django model instances after post-generation hooks. + + To use this derive the factory class that uses @factory.post_generation + decorator from factory.django.DjangoModelFactory as well as this, e.g. + class TestFactory(SaveAfterPostGenerationMixin, factory.django.DjangoModelFactory) + + NOTE: Needs to be before factory.django.DjangoModelFactory in the class + definition to work, because of how Python resolves method resolution order (MRO). + + Rationale: + - Because factory 3.3.0 has deprecated saving the instance after + post-generation hooks, and will remove the functionality in the + next major release. + """ + + @classmethod + def _after_postgeneration(cls, instance, create, results=None): + """Save again the instance if creating and at least one hook ran.""" + if create and results: + # Some post-generation hooks ran, and may have modified us. + instance.save() diff --git a/common/models.py b/common/models.py index 6dabf07a..c0a9d6ed 100644 --- a/common/models.py +++ b/common/models.py @@ -1,11 +1,13 @@ -import django import uuid +from copy import deepcopy + from django.conf import settings from django.db import models, transaction from django.utils.translation import gettext_lazy as _ from parler.managers import TranslatableQuerySet as ParlerTranslatableQuerySet from parler.models import TranslatableModel as ParlerTranslatableModel +from common.utils import map_enums_to_values_in_kwargs from palvelutarjotin.exceptions import MissingDefaultTranslationError @@ -28,38 +30,13 @@ class Meta: class TranslatableQuerySet(ParlerTranslatableQuerySet): @transaction.atomic + @map_enums_to_values_in_kwargs def create_translatable_object(self, **kwargs): translations = kwargs.pop("translations") obj = self.create(**kwargs) obj.create_or_update_translations(translations) return obj - def _extract_model_params(self, defaults, **kwargs): - # FIXME: Remove this method when it's possible to update to django-parler 2.0, - # (which is not compatible with django-ilmoitin atm). This function is cherry - # picked from django-parler 2.0 to fix a bug when calling - # queryset.get_or_create(**params) - translated_defaults = {} - if defaults: - for field in self.model._parler_meta.get_all_fields(): - try: - translated_defaults[field] = defaults.pop(field) - except KeyError: - pass - - if django.VERSION < (2, 2): - lookup, params = super( - ParlerTranslatableQuerySet, self - )._extract_model_params(defaults, **kwargs) - params.update(translated_defaults) - return lookup, params - else: - params = super(ParlerTranslatableQuerySet, self)._extract_model_params( - defaults, **kwargs - ) - params.update(translated_defaults) - return params - class TranslatableModel(ParlerTranslatableModel): objects = TranslatableQuerySet.as_manager() @@ -77,6 +54,7 @@ def create_or_update_translations(self, translations): raise MissingDefaultTranslationError("Default translation is missing") self.clear_translations() for translation in translations: + translation = deepcopy(translation) language_code = translation.pop("language_code") if language_code not in settings.PARLER_SUPPORTED_LANGUAGE_CODES: continue diff --git a/common/notification_service.py b/common/notification_service.py index a4bfc412..758efa36 100644 --- a/common/notification_service.py +++ b/common/notification_service.py @@ -1,5 +1,6 @@ import json import logging + import requests logger = logging.getLogger(__name__) diff --git a/common/tests/conftest.py b/common/tests/conftest.py index 50bb3184..d1af8fd2 100644 --- a/common/tests/conftest.py +++ b/common/tests/conftest.py @@ -1,3 +1,6 @@ +from unittest.mock import patch +from uuid import UUID + import factory.random import pytest import responses @@ -5,8 +8,6 @@ from django.test import RequestFactory from freezegun import freeze_time from graphene.test import Client -from unittest.mock import patch -from uuid import UUID import occurrences.signals from common.tests.json_fixtures import * # noqa diff --git a/common/tests/test_utils.py b/common/tests/test_utils.py new file mode 100644 index 00000000..670a91be --- /dev/null +++ b/common/tests/test_utils.py @@ -0,0 +1,254 @@ +import enum +from enum import auto + +import graphene +import pytest + +from common.utils import ( + deepfix_enum_values, + is_enum_value, + map_enums_to_values_in_kwargs, +) + + +class _OrderEnum(graphene.Enum): + FIRST = 1 + SECOND = 2 + + +class _TestEnum(enum.Enum): + TEST = "test_1" + TEST_2 = 2 + + +class _TestGrapheneEnum(graphene.Enum): + FIRST_ENUM_NAME = "FIRST_ENUM_VALUE" + ENUM_NAME_1 = "ENUM_VALUE_1" + ENUM_NAME_2 = "ENUM_VALUE_2" + LAST_ENUM_NAME = "LAST_ENUM_VALUE" + + +class _TestGrapheneEnumAuto(graphene.Enum): + _123 = auto() + test = auto() + + +@pytest.mark.parametrize( + "value", + [ + _TestEnum.TEST, + _TestEnum.TEST_2, + _TestGrapheneEnum.FIRST_ENUM_NAME, + _TestGrapheneEnum.ENUM_NAME_1, + _TestGrapheneEnum.ENUM_NAME_2, + _TestGrapheneEnum.LAST_ENUM_NAME, + _TestGrapheneEnumAuto._123, + _TestGrapheneEnumAuto.test, + ], +) +def test_is_enum_value_true(value): + assert is_enum_value(value) is True + + +@pytest.mark.parametrize( + "value", + [ + None, + 0, + 1, + 2, + "0", + "1", + "2", + "FIRST_ENUM_VALUE", + "ENUM_VALUE_1", + "ENUM_VALUE_2", + "LAST_ENUM_VALUE", + ], +) +def test_is_enum_value_false(value): + assert is_enum_value(value) is False + + +@pytest.mark.parametrize( + "input", + [ + None, + 0, + 1, + 2, + "0", + "1", + "2", + "FIRST_ENUM_VALUE", + "ENUM_VALUE_1", + "ENUM_VALUE_2", + "LAST_ENUM_VALUE", + {1, 2, 3, "test", 2}, + (1, 2, 3, "test", 2), + [1, 2, 3, "test", 2], + (1, [2, {3: {4, (11, (12,), 13, None, "test")}}]), + ], +) +def test_deepfix_enum_values_unchanged(input): + assert deepfix_enum_values(input) == input + + +def test_deepfix_enum_values_changes_output_but_not_input(): + """ + Test that the input is not modified even when the output is. + """ + input = {_TestEnum.TEST: "test"} + assert deepfix_enum_values(input) == {"test_1": "test"} + assert input == {_TestEnum.TEST: "test"} + + +@pytest.mark.parametrize( + "input,expected_output", + [ + (_TestEnum.TEST, "test_1"), + (_TestEnum.TEST_2, 2), + (_TestGrapheneEnum.FIRST_ENUM_NAME, "FIRST_ENUM_VALUE"), + (_TestGrapheneEnum.ENUM_NAME_1, "ENUM_VALUE_1"), + (_TestGrapheneEnum.ENUM_NAME_2, "ENUM_VALUE_2"), + (_TestGrapheneEnum.LAST_ENUM_NAME, "LAST_ENUM_VALUE"), + (_TestGrapheneEnumAuto._123, 1), + (_TestGrapheneEnumAuto.test, 2), + ( + [_TestGrapheneEnumAuto.test, _TestEnum.TEST, 123, "TEST"], + [2, "test_1", 123, "TEST"], + ), + ({_TestEnum.TEST: "test"}, {"test_1": "test"}), + ( + { + _TestEnum.TEST: [ + "test", + "123", + 1234, + _TestGrapheneEnumAuto.test, + ( + _TestEnum.TEST_2, + _TestGrapheneEnum.ENUM_NAME_1, + _TestGrapheneEnumAuto.test, + ), + { + _TestGrapheneEnumAuto.test, + "not_enum", + _TestEnum.TEST, + _TestEnum.TEST_2, + }, + { + "not_enum_key": "not_enum_value", + _TestEnum.TEST: _TestGrapheneEnumAuto.test, + }, + (_TestGrapheneEnumAuto.test, _TestEnum.TEST, "not_enum"), + [_TestEnum.TEST, _TestGrapheneEnumAuto.test], + _TestGrapheneEnumAuto.test, + ], + _TestGrapheneEnum.ENUM_NAME_1: { + _TestEnum.TEST_2, + _TestGrapheneEnumAuto.test, + _TestGrapheneEnum.ENUM_NAME_1, + }, + }, + { + "test_1": [ + "test", + "123", + 1234, + 2, + (2, "ENUM_VALUE_1", 2), + {2, "not_enum", "test_1"}, + {"not_enum_key": "not_enum_value", "test_1": 2}, + (2, "test_1", "not_enum"), + ["test_1", 2], + 2, + ], + "ENUM_VALUE_1": { + 2, + 2, + "ENUM_VALUE_1", + }, + }, + ), + ( + ( + _TestEnum.TEST, + [ + _TestEnum.TEST_2, + { + _TestGrapheneEnum.FIRST_ENUM_NAME: { + _TestGrapheneEnum.ENUM_NAME_1, + (_TestGrapheneEnum.ENUM_NAME_2,), + _TestGrapheneEnum.LAST_ENUM_NAME, + } + }, + ], + ), + ( + "test_1", + [ + 2, + { + "FIRST_ENUM_VALUE": { + "ENUM_VALUE_1", + ("ENUM_VALUE_2",), + "LAST_ENUM_VALUE", + } + }, + ], + ), + ), + ], +) +def test_deepfix_enum_values_changed(input, expected_output): + assert deepfix_enum_values(input) == expected_output + + +@pytest.mark.parametrize("args", [(), ("testing", 1234, ["a", 1, 2, "b"])]) +@pytest.mark.parametrize( + "kwargs,expected_kwargs", + [ + ({"x": _OrderEnum.FIRST}, {"x": 1}), + ({"x": _OrderEnum.SECOND}, {"x": 2}), + ({"x": _OrderEnum.FIRST, "y": _OrderEnum.SECOND}, {"x": 1, "y": 2}), + ( + { + "order_priority_reverse_mapping": [ + { + 1: [_OrderEnum.SECOND, _OrderEnum.FIRST], + 2: [_OrderEnum.FIRST, _OrderEnum.SECOND], + }, + "test", + 1, + 2, + 3, + _OrderEnum.FIRST, + _OrderEnum.SECOND, + 3, + ] + }, + { + "order_priority_reverse_mapping": [ + { + 1: [2, 1], + 2: [1, 2], + }, + "test", + 1, + 2, + 3, + 1, + 2, + 3, + ] + }, + ), + ], +) +def test_map_enums_to_values_in_kwargs(args, kwargs, expected_kwargs): + @map_enums_to_values_in_kwargs + def method(*args, **kwargs): + return (args, kwargs) + + assert method(*args, **kwargs) == (args, expected_kwargs) diff --git a/common/utils.py b/common/utils.py index 51448bbe..78920859 100644 --- a/common/utils.py +++ b/common/utils.py @@ -1,9 +1,12 @@ -import graphene +import enum from datetime import datetime + +import graphene from django.conf import settings from django.core.exceptions import PermissionDenied from django.db import transaction from django.utils import timezone +from django.utils.translation import gettext_lazy as _ from graphene import Node from graphql_relay import from_global_id @@ -21,6 +24,41 @@ ) +def is_enum_value(value): + """ + Check if a value is an enum value, e.g. TestEnum.FI + where TestEnum derives from enum.Enum or graphene.Enum. + """ + # Works both for enum.Enum and graphene.Enum + return type(type(value)) is enum.EnumMeta + + +def deepfix_enum_values(data): + """ + Fix enum values recursively in/out of dictionaries, lists, sets, and tuples. + """ + if isinstance(data, dict): + return {deepfix_enum_values(k): deepfix_enum_values(v) for k, v in data.items()} + elif isinstance(data, (list, set, tuple)): + return type(data)(deepfix_enum_values(v) for v in data) + elif is_enum_value(data): + return data.value + else: + return data + + +def map_enums_to_values_in_kwargs(method): + """ + Decorator that maps enums to their values in keyword arguments. + """ + + def wrapper(*args, **kwargs): + fixed_kwargs = deepfix_enum_values(kwargs) + return method(*args, **fixed_kwargs) + + return wrapper + + def format_linked_event_datetime(datetime_obj): if not datetime_obj: return None @@ -67,7 +105,7 @@ def convert_to_localtime_tz(value): def get_obj_from_global_id(info, global_id, expected_obj_type): obj = Node.get_node_from_global_id(info, global_id) - if not obj or type(obj) != expected_obj_type: + if not obj or type(obj) is not expected_obj_type: raise ObjectDoesNotExistError( f"{expected_obj_type.__name__} matching query does not exist." ) @@ -86,3 +124,12 @@ def get_editable_obj_from_global_id(info, global_id, expected_obj_type): raise PermissionDenied( f"User does not have permission to edit this {expected_obj_type.__name__}" ) + + +def raise_permission_denied_if_not_staff(user): + """ + Raise PermissionDenied if user is not staff + :raises django.core.exceptions.PermissionDenied: If user is not staff + """ + if not user or not getattr(user, "is_staff"): + raise PermissionDenied(_("You do not have permission to perform this action")) diff --git a/docker-compose.yml b/docker-compose.yml index c0e3c57b..3073b031 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ services: kultus-db: - image: postgres:10 + image: postgres:13 restart: on-failure environment: POSTGRES_USER: kultus @@ -9,7 +9,7 @@ services: ports: - ${DB_PORT:-5434}:5432 volumes: - - pgdata:/var/lib/postgresql/data + - pgdata:/var/lib/postgresql@13/data container_name: kultus-db django: diff --git a/gdpr/models.py b/gdpr/models.py index a78f03d8..0bd930c8 100644 --- a/gdpr/models.py +++ b/gdpr/models.py @@ -1,6 +1,7 @@ -from django.db import models from typing import List +from django.db import models + from gdpr.consts import CLEARED_VALUE diff --git a/gdpr/service.py b/gdpr/service.py index a469c0bd..39ccf2a2 100644 --- a/gdpr/service.py +++ b/gdpr/service.py @@ -1,7 +1,8 @@ import logging -from helsinki_gdpr.types import ErrorResponse from typing import Optional, TYPE_CHECKING +from helsinki_gdpr.types import ErrorResponse + if TYPE_CHECKING: from organisations.models import User as UserType diff --git a/gdpr/tests/conftest.py b/gdpr/tests/conftest.py index fb6dcb4b..05e4247e 100644 --- a/gdpr/tests/conftest.py +++ b/gdpr/tests/conftest.py @@ -1,4 +1,5 @@ import datetime + import pytest from helusers.settings import api_token_auth_settings from jose import jwt diff --git a/gdpr/tests/snapshots/snap_test_gdpr_api.py b/gdpr/tests/snapshots/snap_test_gdpr_api.py index 5e9d8a8e..03cbb7b8 100644 --- a/gdpr/tests/snapshots/snap_test_gdpr_api.py +++ b/gdpr/tests/snapshots/snap_test_gdpr_api.py @@ -4,625 +4,863 @@ from snapshottest import Snapshot + snapshots = Snapshot() -snapshots[ - "test_delete_profile_data_from_gdpr_api[most_complex] enrolment should exist but not contain any person related sensitive data after deletion" -] = { - "children": [ - {"key": "ENROLMENT_TIME", "value": "2020-01-04T00:00:00+00:00"}, - {"key": "UPDATED_AT", "value": "2020-01-04T00:00:00+00:00"}, - {"key": "STATUS", "value": "pending"}, - { - "children": [ - {"key": "START_TIME", "value": "2003-08-21T11:00:41+00:00"}, - {"key": "END_TIME", "value": "2001-09-28T16:06:51+00:00"}, - {"key": "CREATED_AT", "value": "2020-01-04T00:00:00+00:00"}, - {"key": "UPDATED_AT", "value": "2020-01-04T00:00:00+00:00"}, +snapshots['test_delete_profile_data_from_gdpr_api[most_complex] enrolment should exist but not contain any person related sensitive data after deletion'] = { + 'children': [ + { + 'key': 'ENROLMENT_TIME', + 'value': '2020-01-04T00:00:00+00:00' + }, + { + 'key': 'UPDATED_AT', + 'value': '2020-01-04T00:00:00+00:00' + }, + { + 'key': 'STATUS', + 'value': 'pending' + }, + { + 'children': [ + { + 'key': 'START_TIME', + 'value': '2010-07-23T16:15:55.542261+00:00' + }, + { + 'key': 'END_TIME', + 'value': '2008-11-04T19:11:30.730104+00:00' + }, + { + 'key': 'CREATED_AT', + 'value': '2020-01-04T00:00:00+00:00' + }, + { + 'key': 'UPDATED_AT', + 'value': '2020-01-04T00:00:00+00:00' + }, { - "children": [ - {"key": "LINKED_EVENT_ID", "value": "FrTcm"}, - {"key": "ORGANISATION", "value": "Carroll, Adams and Evans"}, + 'children': [ + { + 'key': 'LINKED_EVENT_ID', + 'value': 'FrTcm' + }, { - "key": "CONTACT_PERSON", - "value": "Erika Martinez, (697)612-9636, mark29@example.com", + 'key': 'ORGANISATION', + 'value': 'Carroll, Adams and Evans' }, + { + 'key': 'CONTACT_PERSON', + 'value': 'Erika Martinez, (569)876-1296, mark29@example.com' + } ], - "key": "PALVELUTARJOTINEVENT", - }, + 'key': 'PALVELUTARJOTINEVENT' + } ], - "key": "OCCURRENCE", - }, + 'key': 'OCCURRENCE' + } ], - "key": "ENROLMENT", + 'key': 'ENROLMENT' } -snapshots[ - "test_delete_profile_data_from_gdpr_api[most_complex] event queue enrolment should exist but not contain any person related sensitive data after deletion" -] = { - "children": [ - {"key": "ENROLMENT_TIME", "value": "2020-01-04T00:00:00+00:00"}, - {"key": "UPDATED_AT", "value": "2020-01-04T00:00:00+00:00"}, - {"key": "NOTIFICATION_TYPE", "value": "email"}, +snapshots['test_delete_profile_data_from_gdpr_api[most_complex] event queue enrolment should exist but not contain any person related sensitive data after deletion'] = { + 'children': [ { - "key": "STUDY_GROUP", - "value": "1 Tough plant traditional after born up always. Return student light a point charge.", + 'key': 'ENROLMENT_TIME', + 'value': '2020-01-04T00:00:00+00:00' }, { - "children": [ - {"key": "LINKED_EVENT_ID", "value": "AVlym"}, - {"key": "ORGANISATION", "value": "Short-Cole"}, + 'key': 'UPDATED_AT', + 'value': '2020-01-04T00:00:00+00:00' + }, + { + 'key': 'NOTIFICATION_TYPE', + 'value': 'email' + }, + { + 'key': 'STUDY_GROUP', + 'value': '1 Tough plant traditional after born up always. Return student light a point charge.' + }, + { + 'children': [ { - "key": "CONTACT_PERSON", - "value": "Angelica Juarez, 483-397-4524, ian73@example.org", + 'key': 'LINKED_EVENT_ID', + 'value': 'TwsLM' }, + { + 'key': 'ORGANISATION', + 'value': 'Singleton PLC' + }, + { + 'key': 'CONTACT_PERSON', + 'value': 'Robert Davis, 327.543.4893, lanekayla@example.org' + } ], - "key": "PALVELUTARJOTINEVENT", - }, + 'key': 'PALVELUTARJOTINEVENT' + } ], - "key": "EVENTQUEUEENROLMENT", + 'key': 'EVENTQUEUEENROLMENT' } -snapshots[ - "test_delete_profile_data_from_gdpr_api[most_complex] study group should exist but not contain any person related sensitive data after deletion" -] = { - "children": [ - {"key": "UNIT_ID", "value": None}, +snapshots['test_delete_profile_data_from_gdpr_api[most_complex] study group should exist but not contain any person related sensitive data after deletion'] = { + 'children': [ + { + 'key': 'UNIT_ID', + 'value': None + }, + { + 'key': 'UNIT_NAME', + 'value': 'Daughter animal single whom involve. Different student moment apply president unit.' + }, { - "key": "UNIT_NAME", - "value": "Daughter animal single whom involve. Different student moment apply president unit.", + 'key': 'GROUP_SIZE', + 'value': 420 }, - {"key": "GROUP_SIZE", "value": 420}, - {"key": "AMOUNT_OF_ADULT", "value": 0}, - {"key": "GROUP_NAME", "value": "Resource set feeling within Mr total learn."}, { - "key": "EXTRA_NEEDS", - "value": "Culture most page reduce green conference front. Decide very data four.", + 'key': 'AMOUNT_OF_ADULT', + 'value': 0 }, - {"key": "PREFERRED_TIMES", "value": "Increase player power over."}, - {"key": "STUDY_LEVELS", "value": ""}, { - "children": [ + 'key': 'GROUP_NAME', + 'value': 'Resource set feeling within Mr total learn.' + }, + { + 'key': 'EXTRA_NEEDS', + 'value': 'Culture most page reduce green conference front. Decide very data four.' + }, + { + 'key': 'PREFERRED_TIMES', + 'value': 'Increase player power over.' + }, + { + 'key': 'STUDY_LEVELS', + 'value': '' + }, + { + 'children': [ { - "children": [ - {"key": "ENROLMENT_TIME", "value": "2020-01-04T00:00:00+00:00"}, - {"key": "UPDATED_AT", "value": "2020-01-04T00:00:00+00:00"}, - {"key": "STATUS", "value": "pending"}, + 'children': [ + { + 'key': 'ENROLMENT_TIME', + 'value': '2020-01-04T00:00:00+00:00' + }, + { + 'key': 'UPDATED_AT', + 'value': '2020-01-04T00:00:00+00:00' + }, + { + 'key': 'STATUS', + 'value': 'pending' + }, { - "children": [ + 'children': [ { - "key": "START_TIME", - "value": "1999-08-18T18:01:50+00:00", + 'key': 'START_TIME', + 'value': '1974-05-07T19:29:45.432928+00:00' }, { - "key": "END_TIME", - "value": "1975-12-01T17:32:23+00:00", + 'key': 'END_TIME', + 'value': '1997-04-17T22:13:24.246198+00:00' }, { - "key": "CREATED_AT", - "value": "2020-01-04T00:00:00+00:00", + 'key': 'CREATED_AT', + 'value': '2020-01-04T00:00:00+00:00' }, { - "key": "UPDATED_AT", - "value": "2020-01-04T00:00:00+00:00", + 'key': 'UPDATED_AT', + 'value': '2020-01-04T00:00:00+00:00' }, { - "children": [ - {"key": "LINKED_EVENT_ID", "value": "dufgT"}, + 'children': [ { - "key": "ORGANISATION", - "value": "Carlson, Baker and Wade", + 'key': 'LINKED_EVENT_ID', + 'value': 'mbLjf' }, { - "key": "CONTACT_PERSON", - "value": "Charles Hansen, 194.213.1728, amandayoung@example.org", + 'key': 'ORGANISATION', + 'value': 'Moon-Hernandez' }, + { + 'key': 'CONTACT_PERSON', + 'value': 'Charles Hansen, 419.442.1317, youngpeggy@example.org' + } ], - "key": "PALVELUTARJOTINEVENT", - }, + 'key': 'PALVELUTARJOTINEVENT' + } ], - "key": "OCCURRENCE", - }, + 'key': 'OCCURRENCE' + } ], - "key": "ENROLMENT", + 'key': 'ENROLMENT' } ], - "key": "ENROLMENTS", - }, + 'key': 'ENROLMENTS' + } ], - "key": "STUDYGROUP", + 'key': 'STUDYGROUP' } -snapshots["test_get_profile_data_from_gdpr_api[Complex User, Deleted] 1"] = { - "children": [ - {"key": "UUID", "value": "26850000-2e85-11ea-b347-acde48001122"}, - {"key": "USERNAME", "value": "u-e2cqaaboqui6vm2hvtpeqaarei"}, - {"key": "FIRST_NAME", "value": ""}, - {"key": "LAST_NAME", "value": ""}, - {"key": "EMAIL", "value": ""}, - {"key": "LAST_LOGIN", "value": None}, - {"key": "DATE_JOINED", "value": "2020-01-04T00:00:00+00:00"}, +snapshots['test_get_profile_data_from_gdpr_api[Complex User, Deleted] 1'] = { + 'children': [ + { + 'key': 'UUID', + 'value': '26850000-2e85-11ea-b347-acde48001122' + }, + { + 'key': 'USERNAME', + 'value': 'u-e2cqaaboqui6vm2hvtpeqaarei' + }, + { + 'key': 'FIRST_NAME', + 'value': '' + }, + { + 'key': 'LAST_NAME', + 'value': '' + }, + { + 'key': 'EMAIL', + 'value': '' + }, + { + 'key': 'LAST_LOGIN', + 'value': None + }, + { + 'key': 'DATE_JOINED', + 'value': '2020-01-04T00:00:00+00:00' + } ], - "key": "USER", + 'key': 'USER' } -snapshots["test_get_profile_data_from_gdpr_api[Complex User, Undeleted] 1"] = { - "children": [ - {"key": "UUID", "value": "26850000-2e85-11ea-b347-acde48001122"}, - {"key": "USERNAME", "value": "jeffersonkimberly_3MmHFh"}, - {"key": "FIRST_NAME", "value": "Alexis"}, - {"key": "LAST_NAME", "value": "Black"}, - {"key": "EMAIL", "value": "joshuajohnson@example.com"}, - {"key": "LAST_LOGIN", "value": "2020-01-04T00:00:00+00:00"}, - {"key": "DATE_JOINED", "value": "2020-01-04T00:00:00+00:00"}, - { - "children": [ - {"key": "NAME", "value": "Tina Wilson"}, - {"key": "PHONE_NUMBER", "value": "+1-102-320-2813x072"}, - {"key": "EMAIL_ADDRESS", "value": "fhuynh@example.org"}, - {"key": "LANGUAGE", "value": "fi"}, +snapshots['test_get_profile_data_from_gdpr_api[Complex User, Undeleted] 1'] = { + 'children': [ + { + 'key': 'UUID', + 'value': '26850000-2e85-11ea-b347-acde48001122' + }, + { + 'key': 'USERNAME', + 'value': 'jeffersonkimberly_3MmHFh' + }, + { + 'key': 'FIRST_NAME', + 'value': 'Alexis' + }, + { + 'key': 'LAST_NAME', + 'value': 'Black' + }, + { + 'key': 'EMAIL', + 'value': 'joshuajohnson@example.com' + }, + { + 'key': 'LAST_LOGIN', + 'value': '2020-01-04T00:00:00+00:00' + }, + { + 'key': 'DATE_JOINED', + 'value': '2020-01-04T00:00:00+00:00' + }, + { + 'children': [ + { + 'key': 'NAME', + 'value': 'Tina Wilson' + }, + { + 'key': 'PHONE_NUMBER', + 'value': '+1-910-423-2028x130' + }, + { + 'key': 'EMAIL_ADDRESS', + 'value': 'fhuynh@example.org' + }, + { + 'key': 'LANGUAGE', + 'value': 'fi' + }, { - "key": "PLACE_IDS", - "value": "SedRknnouKQItjsGbbnC, aIeOatnXjyxRexoPZaRK, VOMVMNZoGFTsuALvDSCv", + 'key': 'PLACE_IDS', + 'value': 'SedRknnouKQItjsGbbnC, aIeOatnXjyxRexoPZaRK, VOMVMNZoGFTsuALvDSCv' }, { - "children": [ + 'children': [ { - "children": [ - {"key": "NAME", "value": "Williams-Newton"}, - {"key": "PHONE_NUMBER", "value": "976-380-3466x9727"}, - {"key": "TYPE", "value": "user"}, - {"key": "PUBLISHER_ID", "value": "TUOfT"}, + 'children': [ + { + 'key': 'NAME', + 'value': 'Williams-Newton' + }, + { + 'key': 'PHONE_NUMBER', + 'value': '497-963-8034x6697' + }, + { + 'key': 'TYPE', + 'value': 'user' + }, + { + 'key': 'PUBLISHER_ID', + 'value': 'TUOfT' + } ], - "key": "ORGANISATION", + 'key': 'ORGANISATION' } ], - "key": "ORGANISATIONS", + 'key': 'ORGANISATIONS' }, [ { - "children": [ - {"key": "NAME", "value": "Young, Garcia and Dean"}, - {"key": "PHONE_NUMBER", "value": "+1-827-408-4769x47032"}, + 'children': [ { - "key": "DESCRIPTION", - "value": """Beautiful if his their. Stuff election stay every. Base may middle good father boy economy. -Enjoy office water those notice medical. Already name likely behind mission network. Think significant land especially can quite.""", + 'key': 'NAME', + 'value': 'Young, Garcia and Dean' }, + { + 'key': 'PHONE_NUMBER', + 'value': '+1-582-474-0847x69470' + }, + { + 'key': 'DESCRIPTION', + 'value': '''Beautiful if his their. Stuff election stay every. Base may middle good father boy economy. +Enjoy office water those notice medical. Already name likely behind mission network. Think significant land especially can quite.''' + } ], - "key": "ORGANISATIONPROPOSAL", + 'key': 'ORGANISATIONPROPOSAL' } ], [ { - "children": [ - {"key": "UNIT_ID", "value": None}, + 'children': [ { - "key": "UNIT_NAME", - "value": "Bit college question animal long. Sometimes growth check court.", + 'key': 'UNIT_ID', + 'value': None }, - {"key": "GROUP_SIZE", "value": 519}, - {"key": "AMOUNT_OF_ADULT", "value": 0}, { - "key": "GROUP_NAME", - "value": "Decade address have turn serve me every traditional. Sound describe risk newspaper reflect four.", + 'key': 'UNIT_NAME', + 'value': 'Tough plant traditional after born up always. Return student light a point charge.' }, { - "key": "EXTRA_NEEDS", - "value": "Arm listen money language which risk.", + 'key': 'GROUP_SIZE', + 'value': 2 }, { - "key": "PREFERRED_TIMES", - "value": "Result let join might player.", + 'key': 'AMOUNT_OF_ADULT', + 'value': 0 }, { - "key": "STUDY_LEVELS", - "value": "Cultural cell at. (id: Democrat., level: 3), Myself simple paper. (id: Happen., level: 4), Town back though. (id: Decade., level: 9)", + 'key': 'GROUP_NAME', + 'value': 'Hand human value base pattern democratic focus. Kind various laugh smile behavior.' }, { - "children": [ + 'key': 'EXTRA_NEEDS', + 'value': 'Hot identify each its general. By garden so country past involve choose.' + }, + { + 'key': 'PREFERRED_TIMES', + 'value': 'Difficult special respond.' + }, + { + 'key': 'STUDY_LEVELS', + 'value': 'Cultural cell at. (id: Democrat., level: 3), Myself simple paper. (id: Happen., level: 4), Town back though. (id: Decade., level: 9)' + }, + { + 'children': [ { - "children": [ + 'children': [ + { + 'key': 'ENROLMENT_TIME', + 'value': '2020-01-04T00:00:00+00:00' + }, { - "key": "ENROLMENT_TIME", - "value": "2020-01-04T00:00:00+00:00", + 'key': 'UPDATED_AT', + 'value': '2020-01-04T00:00:00+00:00' }, { - "key": "UPDATED_AT", - "value": "2020-01-04T00:00:00+00:00", + 'key': 'STATUS', + 'value': 'pending' }, - {"key": "STATUS", "value": "pending"}, { - "children": [ + 'children': [ { - "key": "START_TIME", - "value": "1999-08-18T18:01:50+00:00", + 'key': 'START_TIME', + 'value': '2010-07-23T16:15:55.542261+00:00' }, { - "key": "END_TIME", - "value": "1975-12-01T17:32:23+00:00", + 'key': 'END_TIME', + 'value': '2008-11-04T19:11:30.730104+00:00' }, { - "key": "CREATED_AT", - "value": "2020-01-04T00:00:00+00:00", + 'key': 'CREATED_AT', + 'value': '2020-01-04T00:00:00+00:00' }, { - "key": "UPDATED_AT", - "value": "2020-01-04T00:00:00+00:00", + 'key': 'UPDATED_AT', + 'value': '2020-01-04T00:00:00+00:00' }, { - "children": [ + 'children': [ { - "key": "LINKED_EVENT_ID", - "value": "dufgT", + 'key': 'LINKED_EVENT_ID', + 'value': 'FrTcm' }, { - "key": "ORGANISATION", - "value": "Carlson, Baker and Wade", + 'key': 'ORGANISATION', + 'value': 'Carroll, Adams and Evans' }, { - "key": "CONTACT_PERSON", - "value": "Charles Hansen, 194.213.1728, amandayoung@example.org", - }, + 'key': 'CONTACT_PERSON', + 'value': 'Erika Martinez, (569)876-1296, mark29@example.com' + } ], - "key": "PALVELUTARJOTINEVENT", - }, + 'key': 'PALVELUTARJOTINEVENT' + } ], - "key": "OCCURRENCE", - }, + 'key': 'OCCURRENCE' + } ], - "key": "ENROLMENT", - } - ], - "key": "ENROLMENTS", - }, - ], - "key": "STUDYGROUP", - }, - { - "children": [ - {"key": "UNIT_ID", "value": None}, - { - "key": "UNIT_NAME", - "value": "Tough plant traditional after born up always. Return student light a point charge.", - }, - {"key": "GROUP_SIZE", "value": 2}, - {"key": "AMOUNT_OF_ADULT", "value": 0}, - { - "key": "GROUP_NAME", - "value": "Hand human value base pattern democratic focus. Kind various laugh smile behavior.", - }, - { - "key": "EXTRA_NEEDS", - "value": "Hot identify each its general. By garden so country past involve choose.", - }, - { - "key": "PREFERRED_TIMES", - "value": "Difficult special respond.", - }, - { - "key": "STUDY_LEVELS", - "value": "Cultural cell at. (id: Democrat., level: 3), Myself simple paper. (id: Happen., level: 4), Town back though. (id: Decade., level: 9)", - }, - { - "children": [ + 'key': 'ENROLMENT' + }, { - "children": [ + 'children': [ { - "key": "ENROLMENT_TIME", - "value": "2020-01-04T00:00:00+00:00", + 'key': 'ENROLMENT_TIME', + 'value': '2020-01-04T00:00:00+00:00' }, { - "key": "UPDATED_AT", - "value": "2020-01-04T00:00:00+00:00", + 'key': 'UPDATED_AT', + 'value': '2020-01-04T00:00:00+00:00' }, - {"key": "STATUS", "value": "pending"}, { - "children": [ + 'key': 'STATUS', + 'value': 'pending' + }, + { + 'children': [ { - "key": "START_TIME", - "value": "2003-08-21T11:00:41+00:00", + 'key': 'START_TIME', + 'value': '2018-02-12T23:26:33.996487+00:00' }, { - "key": "END_TIME", - "value": "2001-09-28T16:06:51+00:00", + 'key': 'END_TIME', + 'value': '2019-10-02T02:55:30.688102+00:00' }, { - "key": "CREATED_AT", - "value": "2020-01-04T00:00:00+00:00", + 'key': 'CREATED_AT', + 'value': '2020-01-04T00:00:00+00:00' }, { - "key": "UPDATED_AT", - "value": "2020-01-04T00:00:00+00:00", + 'key': 'UPDATED_AT', + 'value': '2020-01-04T00:00:00+00:00' }, { - "children": [ + 'children': [ { - "key": "LINKED_EVENT_ID", - "value": "FrTcm", + 'key': 'LINKED_EVENT_ID', + 'value': 'stCwh' }, { - "key": "ORGANISATION", - "value": "Carroll, Adams and Evans", + 'key': 'ORGANISATION', + 'value': 'Walters, Taylor and Boyd' }, { - "key": "CONTACT_PERSON", - "value": "Erika Martinez, (697)612-9636, mark29@example.com", - }, + 'key': 'CONTACT_PERSON', + 'value': 'James Johnson, 962-942-2074x4988, bullockcarly@example.org' + } ], - "key": "PALVELUTARJOTINEVENT", - }, + 'key': 'PALVELUTARJOTINEVENT' + } ], - "key": "OCCURRENCE", - }, + 'key': 'OCCURRENCE' + } ], - "key": "ENROLMENT", - }, + 'key': 'ENROLMENT' + } + ], + 'key': 'ENROLMENTS' + } + ], + 'key': 'STUDYGROUP' + }, + { + 'children': [ + { + 'key': 'UNIT_ID', + 'value': None + }, + { + 'key': 'UNIT_NAME', + 'value': 'Bit college question animal long. Sometimes growth check court.' + }, + { + 'key': 'GROUP_SIZE', + 'value': 519 + }, + { + 'key': 'AMOUNT_OF_ADULT', + 'value': 0 + }, + { + 'key': 'GROUP_NAME', + 'value': 'Decade address have turn serve me every traditional. Sound describe risk newspaper reflect four.' + }, + { + 'key': 'EXTRA_NEEDS', + 'value': 'Arm listen money language which risk.' + }, + { + 'key': 'PREFERRED_TIMES', + 'value': 'Result let join might player.' + }, + { + 'key': 'STUDY_LEVELS', + 'value': 'Cultural cell at. (id: Democrat., level: 3), Myself simple paper. (id: Happen., level: 4), Town back though. (id: Decade., level: 9)' + }, + { + 'children': [ { - "children": [ + 'children': [ { - "key": "ENROLMENT_TIME", - "value": "2020-01-04T00:00:00+00:00", + 'key': 'ENROLMENT_TIME', + 'value': '2020-01-04T00:00:00+00:00' }, { - "key": "UPDATED_AT", - "value": "2020-01-04T00:00:00+00:00", + 'key': 'UPDATED_AT', + 'value': '2020-01-04T00:00:00+00:00' }, - {"key": "STATUS", "value": "pending"}, { - "children": [ + 'key': 'STATUS', + 'value': 'pending' + }, + { + 'children': [ { - "key": "START_TIME", - "value": "2000-07-17T22:32:02+00:00", + 'key': 'START_TIME', + 'value': '1974-05-07T19:29:45.432928+00:00' }, { - "key": "END_TIME", - "value": "1993-08-04T01:52:51+00:00", + 'key': 'END_TIME', + 'value': '1997-04-17T22:13:24.246198+00:00' }, { - "key": "CREATED_AT", - "value": "2020-01-04T00:00:00+00:00", + 'key': 'CREATED_AT', + 'value': '2020-01-04T00:00:00+00:00' }, { - "key": "UPDATED_AT", - "value": "2020-01-04T00:00:00+00:00", + 'key': 'UPDATED_AT', + 'value': '2020-01-04T00:00:00+00:00' }, { - "children": [ + 'children': [ { - "key": "LINKED_EVENT_ID", - "value": "LXKYT", + 'key': 'LINKED_EVENT_ID', + 'value': 'mbLjf' }, { - "key": "ORGANISATION", - "value": "Wall-Williams", + 'key': 'ORGANISATION', + 'value': 'Moon-Hernandez' }, { - "key": "CONTACT_PERSON", - "value": "William Collins, (422)074-4988, mgonzales@example.com", - }, + 'key': 'CONTACT_PERSON', + 'value': 'Charles Hansen, 419.442.1317, youngpeggy@example.org' + } ], - "key": "PALVELUTARJOTINEVENT", - }, + 'key': 'PALVELUTARJOTINEVENT' + } ], - "key": "OCCURRENCE", - }, + 'key': 'OCCURRENCE' + } ], - "key": "ENROLMENT", - }, + 'key': 'ENROLMENT' + } ], - "key": "ENROLMENTS", - }, + 'key': 'ENROLMENTS' + } ], - "key": "STUDYGROUP", - }, + 'key': 'STUDYGROUP' + } ], [ { - "children": [ + 'children': [ + { + 'key': 'ENROLMENT_TIME', + 'value': '2020-01-04T00:00:00+00:00' + }, { - "key": "ENROLMENT_TIME", - "value": "2020-01-04T00:00:00+00:00", + 'key': 'UPDATED_AT', + 'value': '2020-01-04T00:00:00+00:00' }, - {"key": "UPDATED_AT", "value": "2020-01-04T00:00:00+00:00"}, - {"key": "NOTIFICATION_TYPE", "value": "email"}, { - "key": "STUDY_GROUP", - "value": "1 Tough plant traditional after born up always. Return student light a point charge.", + 'key': 'NOTIFICATION_TYPE', + 'value': 'email' }, { - "children": [ - {"key": "LINKED_EVENT_ID", "value": "AVlym"}, - {"key": "ORGANISATION", "value": "Short-Cole"}, + 'key': 'STUDY_GROUP', + 'value': '1 Tough plant traditional after born up always. Return student light a point charge.' + }, + { + 'children': [ + { + 'key': 'LINKED_EVENT_ID', + 'value': 'TwsLM' + }, { - "key": "CONTACT_PERSON", - "value": "Angelica Juarez, 483-397-4524, ian73@example.org", + 'key': 'ORGANISATION', + 'value': 'Singleton PLC' }, + { + 'key': 'CONTACT_PERSON', + 'value': 'Robert Davis, 327.543.4893, lanekayla@example.org' + } ], - "key": "PALVELUTARJOTINEVENT", - }, + 'key': 'PALVELUTARJOTINEVENT' + } ], - "key": "EVENTQUEUEENROLMENT", + 'key': 'EVENTQUEUEENROLMENT' } ], [ { - "children": [ + 'children': [ + { + 'key': 'ENROLMENT_TIME', + 'value': '2020-01-04T00:00:00+00:00' + }, + { + 'key': 'UPDATED_AT', + 'value': '2020-01-04T00:00:00+00:00' + }, { - "key": "ENROLMENT_TIME", - "value": "2020-01-04T00:00:00+00:00", + 'key': 'STATUS', + 'value': 'pending' }, - {"key": "UPDATED_AT", "value": "2020-01-04T00:00:00+00:00"}, - {"key": "STATUS", "value": "pending"}, { - "children": [ + 'children': [ { - "key": "START_TIME", - "value": "2003-08-21T11:00:41+00:00", + 'key': 'START_TIME', + 'value': '2010-07-23T16:15:55.542261+00:00' }, { - "key": "END_TIME", - "value": "2001-09-28T16:06:51+00:00", + 'key': 'END_TIME', + 'value': '2008-11-04T19:11:30.730104+00:00' }, { - "key": "CREATED_AT", - "value": "2020-01-04T00:00:00+00:00", + 'key': 'CREATED_AT', + 'value': '2020-01-04T00:00:00+00:00' }, { - "key": "UPDATED_AT", - "value": "2020-01-04T00:00:00+00:00", + 'key': 'UPDATED_AT', + 'value': '2020-01-04T00:00:00+00:00' }, { - "children": [ + 'children': [ { - "key": "LINKED_EVENT_ID", - "value": "FrTcm", + 'key': 'LINKED_EVENT_ID', + 'value': 'FrTcm' }, { - "key": "ORGANISATION", - "value": "Carroll, Adams and Evans", + 'key': 'ORGANISATION', + 'value': 'Carroll, Adams and Evans' }, { - "key": "CONTACT_PERSON", - "value": "Erika Martinez, (697)612-9636, mark29@example.com", - }, + 'key': 'CONTACT_PERSON', + 'value': 'Erika Martinez, (569)876-1296, mark29@example.com' + } ], - "key": "PALVELUTARJOTINEVENT", - }, + 'key': 'PALVELUTARJOTINEVENT' + } ], - "key": "OCCURRENCE", - }, + 'key': 'OCCURRENCE' + } ], - "key": "ENROLMENT", + 'key': 'ENROLMENT' }, { - "children": [ + 'children': [ { - "key": "ENROLMENT_TIME", - "value": "2020-01-04T00:00:00+00:00", + 'key': 'ENROLMENT_TIME', + 'value': '2020-01-04T00:00:00+00:00' }, - {"key": "UPDATED_AT", "value": "2020-01-04T00:00:00+00:00"}, - {"key": "STATUS", "value": "pending"}, { - "children": [ + 'key': 'UPDATED_AT', + 'value': '2020-01-04T00:00:00+00:00' + }, + { + 'key': 'STATUS', + 'value': 'pending' + }, + { + 'children': [ { - "key": "START_TIME", - "value": "2000-07-17T22:32:02+00:00", + 'key': 'START_TIME', + 'value': '2018-02-12T23:26:33.996487+00:00' }, { - "key": "END_TIME", - "value": "1993-08-04T01:52:51+00:00", + 'key': 'END_TIME', + 'value': '2019-10-02T02:55:30.688102+00:00' }, { - "key": "CREATED_AT", - "value": "2020-01-04T00:00:00+00:00", + 'key': 'CREATED_AT', + 'value': '2020-01-04T00:00:00+00:00' }, { - "key": "UPDATED_AT", - "value": "2020-01-04T00:00:00+00:00", + 'key': 'UPDATED_AT', + 'value': '2020-01-04T00:00:00+00:00' }, { - "children": [ + 'children': [ { - "key": "LINKED_EVENT_ID", - "value": "LXKYT", + 'key': 'LINKED_EVENT_ID', + 'value': 'stCwh' }, { - "key": "ORGANISATION", - "value": "Wall-Williams", + 'key': 'ORGANISATION', + 'value': 'Walters, Taylor and Boyd' }, { - "key": "CONTACT_PERSON", - "value": "William Collins, (422)074-4988, mgonzales@example.com", - }, + 'key': 'CONTACT_PERSON', + 'value': 'James Johnson, 962-942-2074x4988, bullockcarly@example.org' + } ], - "key": "PALVELUTARJOTINEVENT", - }, + 'key': 'PALVELUTARJOTINEVENT' + } ], - "key": "OCCURRENCE", - }, + 'key': 'OCCURRENCE' + } ], - "key": "ENROLMENT", + 'key': 'ENROLMENT' }, { - "children": [ + 'children': [ + { + 'key': 'ENROLMENT_TIME', + 'value': '2020-01-04T00:00:00+00:00' + }, { - "key": "ENROLMENT_TIME", - "value": "2020-01-04T00:00:00+00:00", + 'key': 'UPDATED_AT', + 'value': '2020-01-04T00:00:00+00:00' }, - {"key": "UPDATED_AT", "value": "2020-01-04T00:00:00+00:00"}, - {"key": "STATUS", "value": "pending"}, { - "children": [ + 'key': 'STATUS', + 'value': 'pending' + }, + { + 'children': [ { - "key": "START_TIME", - "value": "1999-08-18T18:01:50+00:00", + 'key': 'START_TIME', + 'value': '1974-05-07T19:29:45.432928+00:00' }, { - "key": "END_TIME", - "value": "1975-12-01T17:32:23+00:00", + 'key': 'END_TIME', + 'value': '1997-04-17T22:13:24.246198+00:00' }, { - "key": "CREATED_AT", - "value": "2020-01-04T00:00:00+00:00", + 'key': 'CREATED_AT', + 'value': '2020-01-04T00:00:00+00:00' }, { - "key": "UPDATED_AT", - "value": "2020-01-04T00:00:00+00:00", + 'key': 'UPDATED_AT', + 'value': '2020-01-04T00:00:00+00:00' }, { - "children": [ + 'children': [ { - "key": "LINKED_EVENT_ID", - "value": "dufgT", + 'key': 'LINKED_EVENT_ID', + 'value': 'mbLjf' }, { - "key": "ORGANISATION", - "value": "Carlson, Baker and Wade", + 'key': 'ORGANISATION', + 'value': 'Moon-Hernandez' }, { - "key": "CONTACT_PERSON", - "value": "Charles Hansen, 194.213.1728, amandayoung@example.org", - }, + 'key': 'CONTACT_PERSON', + 'value': 'Charles Hansen, 419.442.1317, youngpeggy@example.org' + } ], - "key": "PALVELUTARJOTINEVENT", - }, + 'key': 'PALVELUTARJOTINEVENT' + } ], - "key": "OCCURRENCE", - }, + 'key': 'OCCURRENCE' + } ], - "key": "ENROLMENT", - }, - ], + 'key': 'ENROLMENT' + } + ] ], - "key": "PERSON", - }, + 'key': 'PERSON' + } ], - "key": "USER", + 'key': 'USER' } -snapshots["test_get_profile_data_from_gdpr_api[Simple User, Deleted] 1"] = { - "children": [ - {"key": "UUID", "value": "26850000-2e85-11ea-b347-acde48001122"}, - {"key": "USERNAME", "value": "u-e2cqaaboqui6vm2hvtpeqaarei"}, - {"key": "FIRST_NAME", "value": ""}, - {"key": "LAST_NAME", "value": ""}, - {"key": "EMAIL", "value": ""}, - {"key": "LAST_LOGIN", "value": None}, - {"key": "DATE_JOINED", "value": "2020-01-04T00:00:00+00:00"}, +snapshots['test_get_profile_data_from_gdpr_api[Simple User, Deleted] 1'] = { + 'children': [ + { + 'key': 'UUID', + 'value': '26850000-2e85-11ea-b347-acde48001122' + }, + { + 'key': 'USERNAME', + 'value': 'u-e2cqaaboqui6vm2hvtpeqaarei' + }, + { + 'key': 'FIRST_NAME', + 'value': '' + }, + { + 'key': 'LAST_NAME', + 'value': '' + }, + { + 'key': 'EMAIL', + 'value': '' + }, + { + 'key': 'LAST_LOGIN', + 'value': None + }, + { + 'key': 'DATE_JOINED', + 'value': '2020-01-04T00:00:00+00:00' + } ], - "key": "USER", + 'key': 'USER' } -snapshots["test_get_profile_data_from_gdpr_api[Simple User, Undeleted] 1"] = { - "children": [ - {"key": "UUID", "value": "26850000-2e85-11ea-b347-acde48001122"}, - {"key": "USERNAME", "value": "jeffersonkimberly_3MmHFh"}, - {"key": "FIRST_NAME", "value": "Alexis"}, - {"key": "LAST_NAME", "value": "Black"}, - {"key": "EMAIL", "value": "joshuajohnson@example.com"}, - {"key": "LAST_LOGIN", "value": "2020-01-04T00:00:00+00:00"}, - {"key": "DATE_JOINED", "value": "2020-01-04T00:00:00+00:00"}, +snapshots['test_get_profile_data_from_gdpr_api[Simple User, Undeleted] 1'] = { + 'children': [ + { + 'key': 'UUID', + 'value': '26850000-2e85-11ea-b347-acde48001122' + }, + { + 'key': 'USERNAME', + 'value': 'jeffersonkimberly_3MmHFh' + }, + { + 'key': 'FIRST_NAME', + 'value': 'Alexis' + }, + { + 'key': 'LAST_NAME', + 'value': 'Black' + }, + { + 'key': 'EMAIL', + 'value': 'joshuajohnson@example.com' + }, + { + 'key': 'LAST_LOGIN', + 'value': '2020-01-04T00:00:00+00:00' + }, + { + 'key': 'DATE_JOINED', + 'value': '2020-01-04T00:00:00+00:00' + } ], - "key": "USER", + 'key': 'USER' } diff --git a/gdpr/tests/test_gdpr_api.py b/gdpr/tests/test_gdpr_api.py index de82921e..ed3ca071 100644 --- a/gdpr/tests/test_gdpr_api.py +++ b/gdpr/tests/test_gdpr_api.py @@ -1,7 +1,8 @@ -import pytest -import requests_mock import urllib.parse import uuid + +import pytest +import requests_mock from django.conf import settings from django.contrib.auth import get_user_model from django.urls import reverse diff --git a/graphene_linked_events/rest_client.py b/graphene_linked_events/rest_client.py index b64aaf41..cf55c819 100644 --- a/graphene_linked_events/rest_client.py +++ b/graphene_linked_events/rest_client.py @@ -131,7 +131,7 @@ def convert_to_string_param(params): if not params: return None for k, v in params.items(): - if type(v) == list: + if type(v) is list: list_to_string = ",".join(str(x) for x in v) params[k] = list_to_string return params diff --git a/graphene_linked_events/schema.py b/graphene_linked_events/schema.py index 313d2f66..942353ce 100644 --- a/graphene_linked_events/schema.py +++ b/graphene_linked_events/schema.py @@ -1,6 +1,8 @@ import json import logging import math +from types import SimpleNamespace + from django.conf import settings from django.core.exceptions import PermissionDenied from django.db import transaction @@ -22,11 +24,11 @@ ) from graphene_file_upload.scalars import Upload from graphql_jwt.decorators import staff_member_required -from types import SimpleNamespace from common.utils import ( get_editable_obj_from_global_id, get_obj_from_global_id, + map_enums_to_values_in_kwargs, update_object_with_translations, ) from graphene_linked_events.utils import ( @@ -815,6 +817,7 @@ class Arguments: @staff_member_required @transaction.atomic + @map_enums_to_values_in_kwargs def mutate(root, info, **kwargs): # Format to JSON POST body p_event_data = kwargs["event"].pop("p_event") @@ -834,9 +837,9 @@ def mutate(root, info, **kwargs): raise MissingMantatoryInformationError("Missing/invalid publisher_id") kwargs["event"]["publisher"] = organisation.publisher_id if kwargs["event"]["draft"]: - kwargs["event"][ - "publication_status" - ] = PalvelutarjotinEvent.PUBLICATION_STATUS_DRAFT + kwargs["event"]["publication_status"] = ( + PalvelutarjotinEvent.PUBLICATION_STATUS_DRAFT + ) body = format_request(kwargs["event"]) # TODO: proper validation if necessary @@ -882,6 +885,7 @@ class Arguments: @staff_member_required @transaction.atomic + @map_enums_to_values_in_kwargs def mutate(root, info, **kwargs): # Format to JSON POST body event_id = kwargs["event"].pop("id") @@ -925,9 +929,9 @@ def mutate(root, info, **kwargs): kwargs["event"]["publisher"] = organisation.publisher_id if kwargs["event"].get("draft", False): - kwargs["event"][ - "publication_status" - ] = PalvelutarjotinEvent.PUBLICATION_STATUS_DRAFT + kwargs["event"]["publication_status"] = ( + PalvelutarjotinEvent.PUBLICATION_STATUS_DRAFT + ) body = format_request(kwargs["event"]) # TODO: proper validation if necessary @@ -950,6 +954,7 @@ class Arguments: @staff_member_required @transaction.atomic + @map_enums_to_values_in_kwargs def mutate(root, info, **kwargs): event_id = kwargs["event"].get("id") try: @@ -972,6 +977,7 @@ class Arguments: @staff_member_required @transaction.atomic + @map_enums_to_values_in_kwargs def mutate(root, info, **kwargs): try: kwargs["event"].update( @@ -991,6 +997,7 @@ class Arguments: response = Field(EventMutationResponse) @staff_member_required + @map_enums_to_values_in_kwargs def mutate(root, info, **kwargs): event_id = kwargs["event_id"] # TODO: proper validation if necessary @@ -1044,6 +1051,7 @@ class Arguments: response = Field(ImageMutationResponse) @staff_member_required + @map_enums_to_values_in_kwargs def mutate(root, info, **kwargs): image = kwargs["image"].pop("image") _validate_image_upload(image) @@ -1065,6 +1073,7 @@ class Arguments: response = Field(ImageMutationResponse) @staff_member_required + @map_enums_to_values_in_kwargs def mutate(root, info, **kwargs): image_id = kwargs["image"].pop("id") body = format_request(kwargs["image"]) @@ -1083,6 +1092,7 @@ class Arguments: response = Field(ImageMutationResponse) @staff_member_required + @map_enums_to_values_in_kwargs def mutate(root, info, **kwargs): image_id = kwargs["image_id"] result = api_client.delete("image", image_id) diff --git a/graphene_linked_events/tests/test_api.py b/graphene_linked_events/tests/test_api.py index 2393e15d..8d8391a1 100644 --- a/graphene_linked_events/tests/test_api.py +++ b/graphene_linked_events/tests/test_api.py @@ -1,15 +1,16 @@ import itertools import json -import pytest -import responses from copy import deepcopy from datetime import datetime, timedelta +from typing import Optional +from unittest.mock import patch + +import pytest +import responses from django.utils import timezone from graphene.utils.str_converters import to_snake_case from graphql_relay import to_global_id from requests.models import HTTPError -from typing import Optional -from unittest.mock import patch import graphene_linked_events from common.tests.utils import ( @@ -944,7 +945,7 @@ def test_create_event_without_organisation_id( assert executed.get("errors") assert executed["errors"][0]["extensions"]["code"] == "GENERAL_ERROR" assert ( - 'In field "organisationId": Expected "String!", found null' + "Field 'organisationId' of required type 'String!' was not provided." in executed["errors"][0]["message"] ) @@ -964,9 +965,9 @@ def test_create_event_with_null_organisation_id( assert executed.get("errors") assert executed["errors"][0]["extensions"]["code"] == "GENERAL_ERROR" assert ( - 'In field "organisationId": Expected "String!", found null' - in executed["errors"][0]["message"] - ) + "Variable '$input' got invalid value None at 'input.organisationId'; " + + "Expected non-nullable type 'String!' not to be None." + ) in executed["errors"][0]["message"] @pytest.mark.parametrize("organisationId", ["", " ", " " * 10]) @@ -983,7 +984,8 @@ def test_create_event_with_empty_or_whitespace_only_organisation_id( executed = staff_api_client.execute(CREATE_EVENT_MUTATION, variables=variables) assert PalvelutarjotinEvent.objects.count() == 0 assert executed.get("errors") - assert executed["errors"][0]["extensions"]["code"] == "OBJECT_DOES_NOT_EXIST_ERROR" + assert executed["errors"][0]["extensions"]["code"] == "GENERAL_ERROR" + assert "Invalid Global ID" in executed["errors"][0]["message"] def test_create_event( @@ -1292,7 +1294,7 @@ def test_update_event_without_organisation_id( assert executed.get("errors") assert executed["errors"][0]["extensions"]["code"] == "GENERAL_ERROR" assert ( - 'In field "organisationId": Expected "String!", found null' + "Field 'organisationId' of required type 'String!' was not provided." in executed["errors"][0]["message"] ) @@ -1316,9 +1318,9 @@ def test_update_event_with_null_organisation_id( assert executed.get("errors") assert executed["errors"][0]["extensions"]["code"] == "GENERAL_ERROR" assert ( - 'In field "organisationId": Expected "String!", found null' - in executed["errors"][0]["message"] - ) + "Variable '$input' got invalid value None at 'input.organisationId'; " + + "Expected non-nullable type 'String!' not to be None." + ) in executed["errors"][0]["message"] @pytest.mark.parametrize("organisationId", ["", " ", " " * 10]) @@ -1339,7 +1341,8 @@ def test_update_event_with_empty_or_whitespace_only_organisation_id( person.organisations.add(organisation) executed = staff_api_client.execute(UPDATE_EVENT_MUTATION, variables=variables) assert executed.get("errors") - assert executed["errors"][0]["extensions"]["code"] == "OBJECT_DOES_NOT_EXIST_ERROR" + assert executed["errors"][0]["extensions"]["code"] == "GENERAL_ERROR" + assert "Invalid Global ID" in executed["errors"][0]["message"] DELETE_EVENT_MUTATION = """ diff --git a/graphene_linked_events/tests/test_utils.py b/graphene_linked_events/tests/test_utils.py index a2b5909a..6691abce 100644 --- a/graphene_linked_events/tests/test_utils.py +++ b/graphene_linked_events/tests/test_utils.py @@ -1,5 +1,6 @@ import json import math + import requests import responses diff --git a/graphene_linked_events/tests/utils.py b/graphene_linked_events/tests/utils.py index 60c825b6..0ef46e79 100644 --- a/graphene_linked_events/tests/utils.py +++ b/graphene_linked_events/tests/utils.py @@ -1,4 +1,5 @@ import json + from requests.exceptions import HTTPError diff --git a/graphene_linked_events/utils.py b/graphene_linked_events/utils.py index 367dd603..d4b3b319 100644 --- a/graphene_linked_events/utils.py +++ b/graphene_linked_events/utils.py @@ -2,10 +2,11 @@ # -into-a-python-object/15882054#15882054 import json from collections import namedtuple +from typing import List + from django.conf import settings from geopy import distance as geopy_distance from geopy import Point -from typing import List from graphene_linked_events.rest_client import LinkedEventsApiClient from palvelutarjotin.exceptions import ApiBadRequestError, ObjectDoesNotExistError diff --git a/manage.py b/manage.py index 94022e11..b2dbd035 100755 --- a/manage.py +++ b/manage.py @@ -1,5 +1,6 @@ #!/usr/bin/env python """Django's command-line utility for administrative tasks.""" + import os import sys diff --git a/notification_importers/admin.py b/notification_importers/admin.py index 110926f5..8d47a805 100644 --- a/notification_importers/admin.py +++ b/notification_importers/admin.py @@ -1,6 +1,6 @@ import importlib - import logging + from django.conf import settings from django.contrib import admin, messages from django.http import HttpResponseRedirect diff --git a/notification_importers/notification_importer.py b/notification_importers/notification_importer.py index eb0864e4..d02fcc83 100644 --- a/notification_importers/notification_importer.py +++ b/notification_importers/notification_importer.py @@ -3,18 +3,19 @@ import io import os import re -import requests from collections import defaultdict +from logging import getLogger +from typing import DefaultDict, Dict, Mapping, Optional, Sequence, Tuple + +import requests from django.conf import settings from django.core.exceptions import ObjectDoesNotExist from django.db import transaction from django_ilmoitin.dummy_context import dummy_context from django_ilmoitin.models import NotificationTemplate, NotificationTemplateException from django_ilmoitin.utils import render_notification_template -from logging import getLogger from parler.utils.context import switch_language from requests import RequestException -from typing import DefaultDict, Dict, Mapping, Optional, Sequence, Tuple # { # "": { @@ -262,9 +263,9 @@ def _fetch_data(self) -> SourceData: source_data[notification_type][language][field] = self.clean_text( content ) - source_data[notification_type][language][ - "subject" - ] = self.__get_subject(content, notification_type) + source_data[notification_type][language]["subject"] = ( + self.__get_subject(content, notification_type) + ) return source_data diff --git a/notification_importers/tests/snapshots/snap_test_notification_google_sheet_importer.py b/notification_importers/tests/snapshots/snap_test_notification_google_sheet_importer.py index c7a83681..ac5ef559 100644 --- a/notification_importers/tests/snapshots/snap_test_notification_google_sheet_importer.py +++ b/notification_importers/tests/snapshots/snap_test_notification_google_sheet_importer.py @@ -16,6 +16,6 @@ ] = """enrolment_approved|enrolment_approved fi original subject|enrolment_approved en original subject|enrolment_approved sv original subject|enrolment_approved fi original body_text|enrolment_approved en original body_text|enrolment_approved sv original body_text||| occurrence_enrolment|occurrence_enrolment fi updated subject|occurrence_enrolment en updated subject|occurrence_enrolment sv updated subject|occurrence_enrolment fi updated body_text|occurrence_enrolment en updated body_text|occurrence_enrolment sv updated body_text|||""" -snapshots[ - "test_update_notifications 1" -] = "enrolment_approved|enrolment_approved fi updated subject|enrolment_approved en updated subject|enrolment_approved sv updated subject|enrolment_approved fi updated body_text|enrolment_approved en updated body_text|enrolment_approved sv updated body_text|||" +snapshots["test_update_notifications 1"] = ( + "enrolment_approved|enrolment_approved fi updated subject|enrolment_approved en updated subject|enrolment_approved sv updated subject|enrolment_approved fi updated body_text|enrolment_approved en updated body_text|enrolment_approved sv updated body_text|||" +) diff --git a/notification_importers/tests/snapshots/snap_test_notification_importer.py b/notification_importers/tests/snapshots/snap_test_notification_importer.py index f1e584da..f82a0d74 100644 --- a/notification_importers/tests/snapshots/snap_test_notification_importer.py +++ b/notification_importers/tests/snapshots/snap_test_notification_importer.py @@ -6,9 +6,9 @@ snapshots = Snapshot() -snapshots[ - "test_update_notifications 1" -] = "enrolment_approved|enrolment_approved fi updated subject|enrolment_approved en updated subject|enrolment_approved sv updated subject|enrolment_approved fi updated body_text|enrolment_approved en updated body_text|enrolment_approved sv updated body_text|||" +snapshots["test_update_notifications 1"] = ( + "enrolment_approved|enrolment_approved fi updated subject|enrolment_approved en updated subject|enrolment_approved sv updated subject|enrolment_approved fi updated body_text|enrolment_approved en updated body_text|enrolment_approved sv updated body_text|||" +) snapshots[ "test_create_non_existing_and_update_existing_notifications 1" diff --git a/notification_importers/tests/test_commands.py b/notification_importers/tests/test_commands.py index 3272a468..8b66b20d 100644 --- a/notification_importers/tests/test_commands.py +++ b/notification_importers/tests/test_commands.py @@ -1,5 +1,6 @@ -import pytest from datetime import datetime, timedelta + +import pytest from django.core import mail from django.core.management import call_command from django.test import TestCase diff --git a/notification_importers/tests/test_notification_google_sheet_importer.py b/notification_importers/tests/test_notification_google_sheet_importer.py index 382b3ea3..89000a26 100644 --- a/notification_importers/tests/test_notification_google_sheet_importer.py +++ b/notification_importers/tests/test_notification_google_sheet_importer.py @@ -61,11 +61,8 @@ def occurrence_enrolment_notification(): def test_create_non_existing_and_update_existing_notifications( enrolment_approved_notification, occurrence_enrolment_notification, snapshot ): - ( - num_of_created, - num_of_updated, - ) = ( - NotificationGoogleSheetImporter().create_missing_and_update_existing_notifications() # noqa: E501 + num_of_created, num_of_updated = ( + NotificationGoogleSheetImporter().create_missing_and_update_existing_notifications() ) assert num_of_created == 0 assert num_of_updated == 2 diff --git a/occurrences/event_api_services.py b/occurrences/event_api_services.py index eb66de29..0c03ecbd 100644 --- a/occurrences/event_api_services.py +++ b/occurrences/event_api_services.py @@ -1,9 +1,10 @@ import json import logging from datetime import timedelta -from django.utils import timezone from typing import List, Optional, TYPE_CHECKING +from django.utils import timezone + from common.utils import format_linked_event_datetime from graphene_linked_events.utils import api_client, format_response, json2obj from palvelutarjotin.exceptions import ( @@ -120,9 +121,9 @@ def send_event_unpublish(p_event: "PalvelutarjotinEvent"): # we first need to fetch the current event object. event_obj = fetch_event_as_json(p_event.linked_event_id) - event_obj[ - "publication_status" - ] = p_event.__class__.PUBLICATION_STATUS_DRAFT # prevent cyclic import + event_obj["publication_status"] = ( + p_event.__class__.PUBLICATION_STATUS_DRAFT + ) # prevent cyclic import update_event_to_linkedevents_api(p_event.linked_event_id, event_obj) @@ -216,12 +217,16 @@ def prepare_published_event_data( "publication_status": p_event.__class__.PUBLICATION_STATUS_PUBLIC, "start_time": format_linked_event_datetime(start_time or timezone.now()), "end_time": format_linked_event_datetime(end_time) if end_time else None, - "enrolment_start_time": format_linked_event_datetime(enrolment_start_time) - if enrolment_start_time - else None, - "enrolment_end_time": format_linked_event_datetime(enrolment_end_time) - if enrolment_end_time - else None, + "enrolment_start_time": ( + format_linked_event_datetime(enrolment_start_time) + if enrolment_start_time + else None + ), + "enrolment_end_time": ( + format_linked_event_datetime(enrolment_end_time) + if enrolment_end_time + else None + ), } if event_data: diff --git a/occurrences/factories.py b/occurrences/factories.py index 8ad83dce..b3941bd1 100644 --- a/occurrences/factories.py +++ b/occurrences/factories.py @@ -1,6 +1,7 @@ import factory import pytz +from common.mixins import SaveAfterPostGenerationMixin from occurrences.models import ( Enrolment, EventQueueEnrolment, @@ -20,6 +21,7 @@ class LanguageFactory(factory.django.DjangoModelFactory): class Meta: model = Language + skip_postgeneration_save = True # Not needed after factory v4.0.0 class PalvelutarjotinEventFactory(factory.django.DjangoModelFactory): @@ -38,9 +40,12 @@ class PalvelutarjotinEventFactory(factory.django.DjangoModelFactory): class Meta: model = PalvelutarjotinEvent + skip_postgeneration_save = True # Not needed after factory v4.0.0 -class OccurrenceFactory(factory.django.DjangoModelFactory): +class OccurrenceFactory( + SaveAfterPostGenerationMixin, factory.django.DjangoModelFactory +): place_id = factory.Faker("text", max_nb_chars=64) min_group_size = factory.Faker("random_int", max=1000) max_group_size = factory.Faker("random_int", max=1000) @@ -83,9 +88,12 @@ class StudyLevelFactory(factory.django.DjangoModelFactory): class Meta: model = StudyLevel + skip_postgeneration_save = True # Not needed after factory v4.0.0 -class StudyGroupFactory(factory.django.DjangoModelFactory): +class StudyGroupFactory( + SaveAfterPostGenerationMixin, factory.django.DjangoModelFactory +): person = factory.SubFactory(PersonFactory) unit_name = factory.Faker("text", max_nb_chars=100) group_size = factory.Faker("random_int", max=1000) @@ -116,6 +124,7 @@ class EventQueueEnrolmentFactory(factory.django.DjangoModelFactory): class Meta: model = EventQueueEnrolment + skip_postgeneration_save = True # Not needed after factory v4.0.0 class EnrolmentFactory(factory.django.DjangoModelFactory): @@ -125,6 +134,7 @@ class EnrolmentFactory(factory.django.DjangoModelFactory): class Meta: model = Enrolment + skip_postgeneration_save = True # Not needed after factory v4.0.0 class VenueCustomDataFactory(factory.django.DjangoModelFactory): @@ -136,3 +146,4 @@ class VenueCustomDataFactory(factory.django.DjangoModelFactory): class Meta: model = VenueCustomData + skip_postgeneration_save = True # Not needed after factory v4.0.0 diff --git a/occurrences/filters.py b/occurrences/filters.py index 1136104b..1aa0084c 100644 --- a/occurrences/filters.py +++ b/occurrences/filters.py @@ -1,5 +1,6 @@ -import django_filters from datetime import timedelta + +import django_filters from django.db.models import F from django.db.models.functions import Coalesce from django.utils import timezone @@ -41,8 +42,7 @@ def filter_by_enrollable(self, qs, name, value): enrolment_end_days=Coalesce("p_event__enrolment_end_days", 0) ).filter( **{ - name - + "__gt": timezone.now() + name + "__gt": timezone.now() + timedelta(days=1) * F("enrolment_end_days") } ) diff --git a/occurrences/management/commands/delete_retention_period_exceeding_contact_info.py b/occurrences/management/commands/delete_retention_period_exceeding_contact_info.py index e558a87f..dabfd132 100644 --- a/occurrences/management/commands/delete_retention_period_exceeding_contact_info.py +++ b/occurrences/management/commands/delete_retention_period_exceeding_contact_info.py @@ -12,9 +12,8 @@ def handle(self, *args, **kwargs): "the retention period..." ) - num_of_deleted_contact_info = ( - PalvelutarjotinEvent.objects.contact_info_retention_period_exceeded().delete_contact_info() # noqa: E501 - ) + events = PalvelutarjotinEvent.objects.contact_info_retention_period_exceeded() + num_of_deleted_contact_info = events.delete_contact_info() msg = ( "No events are exceeding the retention period." diff --git a/occurrences/models.py b/occurrences/models.py index 8869f837..11be3358 100644 --- a/occurrences/models.py +++ b/occurrences/models.py @@ -1,6 +1,8 @@ import logging import warnings from datetime import timedelta +from typing import List, Optional + from dateutil.relativedelta import relativedelta from django.conf import settings from django.contrib.contenttypes.fields import GenericRelation @@ -14,7 +16,6 @@ from helsinki_gdpr.models import SerializableMixin from parler.models import TranslatedFields from requests.exceptions import HTTPError -from typing import List, Optional import occurrences.notification_services as occurrences_services from common.models import ( @@ -590,14 +591,33 @@ def user_can_view(self, user: User): organisation_ids = [ entry[0] for entry in user.person.organisations.values_list("id") ] - return self.with_organisation_ids().filter( - organisation_ids__overlap=organisation_ids + result = ( + self.with_organisation_ids() + .with_queued_enrolments_organisation_ids() + .filter( + Q(organisation_ids__overlap=organisation_ids) + | Q(queued_enrolments_organisation_ids__overlap=organisation_ids) + ) ) + return result def with_organisation_ids(self): return self.annotate( organisation_ids=ArrayAgg( - "enrolments__occurrence__p_event__organisation__pk" + "enrolments__occurrence__p_event__organisation__pk", + filter=Q( + enrolments__occurrence__p_event__organisation__pk__isnull=False + ), + default=[], + ) + ) + + def with_queued_enrolments_organisation_ids(self): + return self.annotate( + queued_enrolments_organisation_ids=ArrayAgg( + "queued_enrolments__p_event__organisation__pk", + filter=Q(queued_enrolments__p_event__organisation__pk__isnull=False), + default=[], ) ) @@ -696,8 +716,12 @@ def save(self, *args, **kwargs): super().save(*args, **kwargs) def is_editable_by_user(self, user): + annotated = ( + self.with_organisation_ids().with_queued_enrolments_organisation_ids() + ) return user.person.organisations.filter( - id__in=self.with_organisation_ids().value("organisation_ids") + Q(id__in=annotated.value("organisation_ids")) + | Q(id__in=annotated.value("queued_enrolments_organisation_ids")) ).exists() @@ -853,7 +877,7 @@ class EventQueueEnrolment(GDPRModel, SerializableMixin, EnrolmentBase): { "name": "study_group", "accessor": lambda group: str(group), - }, # avoid bidirectional serialization, because it wil lend in a forever lopp. + }, # avoid bidirectional serialization, because it will end in a forever loop. {"name": "p_event"}, ) gdpr_sensitive_data_fields = [] diff --git a/occurrences/notification_services.py b/occurrences/notification_services.py index 7a4d81e6..89d16569 100644 --- a/occurrences/notification_services.py +++ b/occurrences/notification_services.py @@ -1,10 +1,11 @@ import logging +from typing import List, Optional, Union + from django.conf import settings from django.db import models from django.db.models import Q from django_ilmoitin.models import NotificationTemplate, NotificationTemplateException from django_ilmoitin.utils import render_notification_template, send_notification -from typing import List, Optional, Union import occurrences.models as occurrences_models from common.notification_service import NotificationService diff --git a/occurrences/schema.py b/occurrences/schema.py index b5d4ad06..7fdb58b9 100644 --- a/occurrences/schema.py +++ b/occurrences/schema.py @@ -1,3 +1,6 @@ +import re +from typing import List + import graphene from django.apps import apps from django.conf import settings @@ -9,12 +12,13 @@ from graphene_django import DjangoConnectionField, DjangoObjectType from graphene_django.filter import DjangoFilterConnectionField from graphql_jwt.decorators import staff_member_required -from typing import List from common.utils import ( get_editable_obj_from_global_id, get_node_id_from_global_id, LanguageEnum, + map_enums_to_values_in_kwargs, + raise_permission_denied_if_not_staff, update_object, update_object_with_translations, ) @@ -330,7 +334,6 @@ def resolve_unit(parent, info, **kwargs): return None @classmethod - @staff_member_required def get_queryset(cls, queryset, info): """ The study groups are available only for the staff members. @@ -339,6 +342,20 @@ def get_queryset(cls, queryset, info): he has access to. So, the study groups list should be filtered by the organisation """ + path = ".".join(str(path_element) for path_element in info.path.as_list()) + path = re.sub(r"\d+", "", path) # Map non-negative integers to "" + if ( + # Allow access to the study group created in EnrolEventQueueMutation + path == "enrolEventQueue.eventQueueEnrolment.studyGroup" + # Allow access to the study group in cancellingEnrolment query + or path == "cancellingEnrolment.studyGroup" + # Allow access to the study group through person's event queue enrolments, + or path == "person.eventqueueenrolmentSet.edges..node.studyGroup" + # Allow access to the study group in EnrolOccurrenceMutation + or path == "enrolOccurrence.enrolments..studyGroup" + ): + return queryset + raise_permission_denied_if_not_staff(info.context.user) return queryset.user_can_view(info.context.user) @@ -410,6 +427,7 @@ class Input: @classmethod @staff_member_required @transaction.atomic + @map_enums_to_values_in_kwargs def mutate_and_get_payload(cls, root, info, **kwargs): p_event = get_editable_obj_from_global_id( info, kwargs["p_event_id"], PalvelutarjotinEvent @@ -425,7 +443,7 @@ def mutate_and_get_payload(cls, root, info, **kwargs): if languages: occurrence.languages.set( - get_instance_list(Language, map(lambda x: x.id.lower(), languages)) + get_instance_list(Language, [x["id"].lower() for x in languages]) ) return AddOccurrenceMutation(occurrence=occurrence) @@ -459,6 +477,7 @@ class Input: @classmethod @staff_member_required @transaction.atomic + @map_enums_to_values_in_kwargs def mutate_and_get_payload(cls, root, info, **kwargs): occurrence = get_editable_obj_from_global_id(info, kwargs.pop("id"), Occurrence) p_event = occurrence.p_event @@ -486,7 +505,7 @@ def mutate_and_get_payload(cls, root, info, **kwargs): add_contact_persons_to_object(info, contact_persons, occurrence) if languages: occurrence.languages.set( - get_instance_list(Language, map(lambda x: x.id.lower(), languages)) + get_instance_list(Language, [x["id"].lower() for x in languages]) ) return UpdateOccurrenceMutation(occurrence=occurrence) @@ -499,6 +518,7 @@ class Input: @classmethod @staff_member_required @transaction.atomic + @map_enums_to_values_in_kwargs def mutate_and_get_payload(cls, root, info, **kwargs): occurrence = get_editable_obj_from_global_id(info, kwargs.pop("id"), Occurrence) if occurrence.p_event.is_published() and not occurrence.cancelled: @@ -520,6 +540,7 @@ class Input: @classmethod @staff_member_required @transaction.atomic + @map_enums_to_values_in_kwargs def mutate_and_get_payload(cls, root, info, **kwargs): occurrence = get_editable_obj_from_global_id(info, kwargs.pop("id"), Occurrence) if occurrence.cancelled: @@ -546,6 +567,7 @@ class Input: @classmethod @staff_member_required @transaction.atomic + @map_enums_to_values_in_kwargs def mutate_and_get_payload(cls, root, info, **kwargs): # TODO: Add validation kwargs["place_id"] = kwargs.pop("id") @@ -572,6 +594,7 @@ class Input: @classmethod @staff_member_required @transaction.atomic + @map_enums_to_values_in_kwargs def mutate_and_get_payload(cls, root, info, **kwargs): # TODO: Add validation try: @@ -589,6 +612,7 @@ class Input: @classmethod @staff_member_required @transaction.atomic + @map_enums_to_values_in_kwargs def mutate_and_get_payload(cls, root, info, **kwargs): try: venue = VenueCustomData.objects.get(pk=kwargs.pop("id")) @@ -695,6 +719,7 @@ class Input(EnrolInputBase): @classmethod @transaction.atomic + @map_enums_to_values_in_kwargs def mutate_and_get_payload(cls, root, info, **kwargs): if settings.CAPTCHA_ENABLED: verify_captcha(kwargs.pop("captcha_key", None)) @@ -738,6 +763,7 @@ class Input: @classmethod @staff_member_required @transaction.atomic + @map_enums_to_values_in_kwargs def mutate_and_get_payload(cls, root, info, **kwargs): group_id = get_node_id_from_global_id( kwargs["study_group_id"], "StudyGroupNode" @@ -766,6 +792,7 @@ class Input: @classmethod @staff_member_required @transaction.atomic + @map_enums_to_values_in_kwargs def mutate_and_get_payload(cls, root, info, **kwargs): occurrence = get_editable_obj_from_global_id( info, kwargs["occurrence_id"], Occurrence @@ -809,6 +836,7 @@ class Input(EnrolInputBase): @classmethod @transaction.atomic + @map_enums_to_values_in_kwargs def mutate_and_get_payload(cls, root, info, **kwargs): if settings.CAPTCHA_ENABLED: verify_captcha(kwargs.pop("captcha_key", None)) @@ -856,6 +884,7 @@ class Input: @classmethod @staff_member_required @transaction.atomic + @map_enums_to_values_in_kwargs def mutate_and_get_payload(cls, root, info, **kwargs): group_id = get_node_id_from_global_id( kwargs["study_group_id"], "StudyGroupNode" @@ -891,6 +920,7 @@ class Input: @classmethod @staff_member_required @transaction.atomic + @map_enums_to_values_in_kwargs def mutate_and_get_payload(cls, root, info, **kwargs): enrolment = get_editable_obj_from_global_id( info, kwargs.pop("enrolment_id"), Enrolment @@ -930,6 +960,7 @@ class Input: @classmethod @staff_member_required @transaction.atomic + @map_enums_to_values_in_kwargs def mutate_and_get_payload(cls, root, info, **kwargs): e = get_editable_obj_from_global_id(info, kwargs["enrolment_id"], Enrolment) custom_message = kwargs.pop("custom_message", None) @@ -958,6 +989,7 @@ class Input: @classmethod @staff_member_required @transaction.atomic + @map_enums_to_values_in_kwargs def mutate_and_get_payload(cls, root, info, **kwargs): enrolments: List[Enrolment] = [] custom_message = kwargs.pop("custom_message", None) @@ -990,6 +1022,7 @@ class Input: @classmethod @staff_member_required @transaction.atomic + @map_enums_to_values_in_kwargs def mutate_and_get_payload(cls, root, info, **kwargs): enrolment = get_editable_obj_from_global_id( info, kwargs["enrolment_id"], Enrolment @@ -1026,6 +1059,7 @@ class Input: @classmethod @transaction.atomic + @map_enums_to_values_in_kwargs def mutate_and_get_payload(cls, root, info, **kwargs): study_group = create_study_group(kwargs) return AddStudyGroupMutation(study_group=study_group) @@ -1048,6 +1082,7 @@ class Input: @classmethod @staff_member_required @transaction.atomic + @map_enums_to_values_in_kwargs def mutate_and_get_payload(cls, root, info, **kwargs): study_group = update_study_group(kwargs) return UpdateStudyGroupMutation(study_group=study_group) @@ -1060,6 +1095,7 @@ class Input: @classmethod @staff_member_required @transaction.atomic + @map_enums_to_values_in_kwargs def mutate_and_get_payload(cls, root, info, **kwargs): study_group_global_id = kwargs.pop("id") study_group_id = get_node_id_from_global_id( @@ -1087,6 +1123,7 @@ class Input: @classmethod @transaction.atomic + @map_enums_to_values_in_kwargs def mutate_and_get_payload(cls, root, info, **kwargs): unique_id = kwargs["unique_id"] token = kwargs.get("token") @@ -1181,6 +1218,7 @@ def resolve_study_level(parent, info, **kwargs): return None @staff_member_required + @map_enums_to_values_in_kwargs def resolve_enrolment_summary(self, info, **kwargs): try: organisation = get_editable_obj_from_global_id( diff --git a/occurrences/schema_services.py b/occurrences/schema_services.py index f3826ef8..75b2f3e4 100644 --- a/occurrences/schema_services.py +++ b/occurrences/schema_services.py @@ -1,9 +1,10 @@ -import requests from datetime import timedelta +from typing import List, Optional, Tuple, Union + +import requests from django.conf import settings from django.db import transaction from django.utils import timezone -from typing import List, Optional, Tuple, Union from common.utils import ( get_node_id_from_global_id, @@ -273,10 +274,10 @@ def enrol_to_occurrence( ) if occurrence.p_event.auto_acceptance: - custom_message: Optional[ - str - ] = enrolment.occurrence.p_event.safe_translation_getter( - "auto_acceptance_message", language_code=person.language + custom_message: Optional[str] = ( + enrolment.occurrence.p_event.safe_translation_getter( + "auto_acceptance_message", language_code=person.language + ) ) # Skip notifications sending here: # Send the notifications all at once when the data changes are done. diff --git a/occurrences/signals.py b/occurrences/signals.py index 0ee92354..c696eae8 100644 --- a/occurrences/signals.py +++ b/occurrences/signals.py @@ -1,4 +1,5 @@ import logging + from anymail.signals import pre_send from django.core.exceptions import ObjectDoesNotExist from django.db import transaction diff --git a/occurrences/tests/notification_template_fixtures.py b/occurrences/tests/notification_template_fixtures.py index 67ada3bc..896d878c 100644 --- a/occurrences/tests/notification_template_fixtures.py +++ b/occurrences/tests/notification_template_fixtures.py @@ -1,4 +1,5 @@ import os + import pytest from common.tests.utils import create_notification_template_in_language diff --git a/occurrences/tests/snapshots/snap_test_api.py b/occurrences/tests/snapshots/snap_test_api.py index 0835eff4..665b335b 100644 --- a/occurrences/tests/snapshots/snap_test_api.py +++ b/occurrences/tests/snapshots/snap_test_api.py @@ -4,277 +4,374 @@ from snapshottest import Snapshot + snapshots = Snapshot() -snapshots["test_add_occurrence_to_published_event 1"] = { - "data": { - "addOccurrence": { - "occurrence": { - "contactPersons": { - "edges": [ - {"node": {"name": "New name"}}, - {"node": {"name": "Sean Rocha"}}, +snapshots['test_add_occurrence_to_published_event 1'] = { + 'data': { + 'addOccurrence': { + 'occurrence': { + 'contactPersons': { + 'edges': [ + { + 'node': { + 'name': 'New name' + } + }, + { + 'node': { + 'name': 'Sean Rocha' + } + } ] }, - "endTime": "2020-05-06T00:00:00+00:00", - "languages": { - "edges": [ - {"node": {"id": "ar", "name": "Arabic"}}, - {"node": {"id": "zh_hans", "name": "Chinese"}}, - {"node": {"id": "en", "name": "English"}}, - {"node": {"id": "ru", "name": "Russia"}}, - {"node": {"id": "sv", "name": "Swedish"}}, + 'endTime': '2020-05-06T00:00:00+00:00', + 'languages': { + 'edges': [ + { + 'node': { + 'id': 'ar', + 'name': 'Arabic' + } + }, + { + 'node': { + 'id': 'zh_hans', + 'name': 'Chinese' + } + }, + { + 'node': { + 'id': 'en', + 'name': 'English' + } + }, + { + 'node': { + 'id': 'ru', + 'name': 'Russia' + } + }, + { + 'node': { + 'id': 'sv', + 'name': 'Swedish' + } + } ] }, - "maxGroupSize": None, - "minGroupSize": 10, - "pEvent": { - "autoAcceptance": False, - "contactEmail": "kariweber@example.org", - "contactPhoneNumber": "(171)341-1450", - "enrolmentEndDays": 0, - "enrolmentStart": "1983-11-13T03:03:17+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "QoxZH", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 2, - }, - "startTime": "2020-05-05T00:00:00+00:00", + 'maxGroupSize': None, + 'minGroupSize': 10, + 'pEvent': { + 'autoAcceptance': False, + 'contactEmail': 'barrettjason@example.org', + 'contactPhoneNumber': '271-434-1145', + 'enrolmentEndDays': 0, + 'enrolmentStart': '1980-03-10T09:31:49.213826+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'QoxZH', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 2 + }, + 'startTime': '2020-05-05T00:00:00+00:00' } } } } -snapshots["test_add_occurrence_to_unpublished_event 1"] = { - "data": { - "addOccurrence": { - "occurrence": { - "contactPersons": { - "edges": [ - {"node": {"name": "New name"}}, - {"node": {"name": "Sean Rocha"}}, +snapshots['test_add_occurrence_to_unpublished_event 1'] = { + 'data': { + 'addOccurrence': { + 'occurrence': { + 'contactPersons': { + 'edges': [ + { + 'node': { + 'name': 'New name' + } + }, + { + 'node': { + 'name': 'Sean Rocha' + } + } ] }, - "endTime": "2020-05-06T00:00:00+00:00", - "languages": { - "edges": [ - {"node": {"id": "ar", "name": "Arabic"}}, - {"node": {"id": "zh_hans", "name": "Chinese"}}, - {"node": {"id": "en", "name": "English"}}, - {"node": {"id": "ru", "name": "Russia"}}, - {"node": {"id": "sv", "name": "Swedish"}}, + 'endTime': '2020-05-06T00:00:00+00:00', + 'languages': { + 'edges': [ + { + 'node': { + 'id': 'ar', + 'name': 'Arabic' + } + }, + { + 'node': { + 'id': 'zh_hans', + 'name': 'Chinese' + } + }, + { + 'node': { + 'id': 'en', + 'name': 'English' + } + }, + { + 'node': { + 'id': 'ru', + 'name': 'Russia' + } + }, + { + 'node': { + 'id': 'sv', + 'name': 'Swedish' + } + } ] }, - "maxGroupSize": None, - "minGroupSize": 10, - "pEvent": { - "autoAcceptance": False, - "contactEmail": "kariweber@example.org", - "contactPhoneNumber": "(171)341-1450", - "enrolmentEndDays": 0, - "enrolmentStart": "1983-11-13T03:03:17+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "QoxZH", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 2, - }, - "startTime": "2020-05-05T00:00:00+00:00", + 'maxGroupSize': None, + 'minGroupSize': 10, + 'pEvent': { + 'autoAcceptance': False, + 'contactEmail': 'barrettjason@example.org', + 'contactPhoneNumber': '271-434-1145', + 'enrolmentEndDays': 0, + 'enrolmentStart': '1980-03-10T09:31:49.213826+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'QoxZH', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 2 + }, + 'startTime': '2020-05-05T00:00:00+00:00' } } } } -snapshots["test_add_study_group 1"] = { - "data": { - "addStudyGroup": { - "studyGroup": { - "amountOfAdult": 1, - "extraNeeds": "Extra needs", - "groupName": "Sample group name", - "groupSize": 20, - "person": { - "emailAddress": "email@address.com", - "language": "SV", - "name": "Name", - "phoneNumber": "123123", - }, - "studyLevels": { - "edges": [ +snapshots['test_add_study_group 1'] = { + 'data': { + 'addStudyGroup': { + 'studyGroup': { + 'amountOfAdult': 1, + 'extraNeeds': 'Extra needs', + 'groupName': 'Sample group name', + 'groupSize': 20, + 'person': { + 'emailAddress': 'email@address.com', + 'language': 'SV', + 'name': 'Name', + 'phoneNumber': '123123' + }, + 'studyLevels': { + 'edges': [ { - "node": { - "id": "grade_1", - "label": "first grade", - "level": 3, - "translations": [ - {"label": "first grade", "languageCode": "EN"} - ], + 'node': { + 'id': 'grade_1', + 'label': 'first grade', + 'level': 3, + 'translations': [ + { + 'label': 'first grade', + 'languageCode': 'EN' + } + ] } } ] }, - "unit": { - "internalId": "https://api.hel.fi/linkedevents/v1/event/helsinki:afxp6tv4xa/", - "name": {"fi": "Raija Malka & Kaija Saariaho: Blick"}, + 'unit': { + 'internalId': 'https://api.hel.fi/linkedevents/v1/event/helsinki:afxp6tv4xa/', + 'name': { + 'fi': 'Raija Malka & Kaija Saariaho: Blick' + } }, - "unitId": "helsinki:afxp6tv4xa", - "unitName": "Sample study group name", + 'unitId': 'helsinki:afxp6tv4xa', + 'unitName': 'Sample study group name' } } } } -snapshots["test_add_study_group 2"] = { - "data": { - "addStudyGroup": { - "studyGroup": { - "amountOfAdult": 1, - "extraNeeds": "Extra needs", - "groupName": "Sample group name", - "groupSize": 20, - "person": { - "emailAddress": "barrettjason@example.org", - "language": "FI", - "name": "Charles Anderson", - "phoneNumber": "134.114.5089x299", - }, - "studyLevels": { - "edges": [ +snapshots['test_add_study_group 2'] = { + 'data': { + 'addStudyGroup': { + 'studyGroup': { + 'amountOfAdult': 1, + 'extraNeeds': 'Extra needs', + 'groupName': 'Sample group name', + 'groupSize': 20, + 'person': { + 'emailAddress': 'kimberlyshort@example.org', + 'language': 'FI', + 'name': 'Charles Anderson', + 'phoneNumber': '213.341.1450x892' + }, + 'studyLevels': { + 'edges': [ { - "node": { - "id": "grade_1", - "label": "first grade", - "level": 3, - "translations": [ - {"label": "first grade", "languageCode": "EN"} - ], + 'node': { + 'id': 'grade_1', + 'label': 'first grade', + 'level': 3, + 'translations': [ + { + 'label': 'first grade', + 'languageCode': 'EN' + } + ] } } ] }, - "unit": { - "internalId": "https://api.hel.fi/linkedevents/v1/event/helsinki:afxp6tv4xa/", - "name": {"fi": "Raija Malka & Kaija Saariaho: Blick"}, + 'unit': { + 'internalId': 'https://api.hel.fi/linkedevents/v1/event/helsinki:afxp6tv4xa/', + 'name': { + 'fi': 'Raija Malka & Kaija Saariaho: Blick' + } }, - "unitId": "helsinki:afxp6tv4xa", - "unitName": "Sample study group name", + 'unitId': 'helsinki:afxp6tv4xa', + 'unitName': 'Sample study group name' } } } } -snapshots["test_add_venue_staff_user 1"] = { - "data": { - "addVenue": { - "venue": { - "description": "Venue description in FI", - "hasAreaForGroupWork": True, - "hasClothingStorage": True, - "hasIndoorPlayingArea": True, - "hasOutdoorPlayingArea": True, - "hasSnackEatingPlace": True, - "hasToiletNearby": True, - "id": "place_id", - "outdoorActivity": True, - "translations": [ - {"description": "Venue description in EN"}, - {"description": "Venue description in FI"}, - ], +snapshots['test_add_venue_staff_user 1'] = { + 'data': { + 'addVenue': { + 'venue': { + 'description': 'Venue description in FI', + 'hasAreaForGroupWork': True, + 'hasClothingStorage': True, + 'hasIndoorPlayingArea': True, + 'hasOutdoorPlayingArea': True, + 'hasSnackEatingPlace': True, + 'hasToiletNearby': True, + 'id': 'place_id', + 'outdoorActivity': True, + 'translations': [ + { + 'description': 'Venue description in FI' + }, + { + 'description': 'Venue description in EN' + } + ] } } } } -snapshots["test_approve_enrolment 1"] = { - "data": {"approveEnrolment": {"enrolment": {"status": "APPROVED"}}} +snapshots['test_approve_enrolment 1'] = { + 'data': { + 'approveEnrolment': { + 'enrolment': { + 'status': 'APPROVED' + } + } + } } -snapshots["test_approve_enrolment 2"] = [ - """no-reply@hel.ninja|['barrettjason@example.org']|Enrolment approved FI| +snapshots['test_approve_enrolment 2'] = [ + '''no-reply@hel.ninja|['kimberlyshort@example.org']|Enrolment approved FI| Event FI: Raija Malka & Kaija Saariaho: Blick Extra event info: VFlOj - Study group: Build natural middle however. + Study group: Leave serve important probably. Sea something western research. Occurrence: 06.01.2020 02.00 - Person: barrettjason@example.org + Person: kimberlyshort@example.org Click this link to cancel the enrolment: - https://kultus.hel.fi/fi/enrolments/cancel/RW5yb2xtZW50Tm9kZTo1OF8yMDIwLTAxLTA0IDAwOjAwOjAwKzAwOjAw + https://kultus.hel.fi/fi/enrolments/cancel/mock-enrolment-unique-id-abc123xyz456 -""" +''' ] -snapshots["test_approve_enrolment_with_custom_message 1"] = { - "data": {"approveEnrolment": {"enrolment": {"status": "APPROVED"}}} +snapshots['test_approve_enrolment_with_custom_message 1'] = { + 'data': { + 'approveEnrolment': { + 'enrolment': { + 'status': 'APPROVED' + } + } + } } -snapshots["test_approve_enrolment_with_custom_message 2"] = [ - """no-reply@hel.ninja|['barrettjason@example.org']|Enrolment approved FI| +snapshots['test_approve_enrolment_with_custom_message 2'] = [ + '''no-reply@hel.ninja|['kimberlyshort@example.org']|Enrolment approved FI| Event FI: Raija Malka & Kaija Saariaho: Blick - Extra event info: UUsgD - Study group: Build natural middle however. + Extra event info: MYfOB + Study group: Leave serve important probably. Sea something western research. Occurrence: 06.01.2020 02.00 - Person: barrettjason@example.org + Person: kimberlyshort@example.org Click this link to cancel the enrolment: - https://kultus.hel.fi/fi/enrolments/cancel/RW5yb2xtZW50Tm9kZTo2MF8yMDIwLTAxLTA0IDAwOjAwOjAwKzAwOjAw + https://kultus.hel.fi/fi/enrolments/cancel/mock-enrolment-unique-id-abc123xyz456 Custom message: custom message -""" +''' ] -snapshots["test_ask_for_cancelled_confirmation_mutation 1"] = { - "data": {"cancelEnrolment": {"enrolment": {"status": "PENDING"}}} -} - -snapshots[ - "test_auto_accept_message_is_used_as_custom_message_in_auto_approved_enrolments[False] 1" -] = { - "data": { - "enrolOccurrence": { - "enrolments": [ - { - "notificationType": "EMAIL", - "occurrence": { - "amountOfSeats": 50, - "remainingSeats": 35, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 15, - "seatsTaken": 15, - "startTime": "2020-01-06T00:00:00+00:00", +snapshots['test_ask_for_cancelled_confirmation_mutation 1'] = { + 'data': { + 'cancelEnrolment': { + 'enrolment': { + 'status': 'PENDING' + } + } + } +} + +snapshots['test_auto_accept_message_is_used_as_custom_message_in_auto_approved_enrolments[False] 1'] = { + 'data': { + 'enrolOccurrence': { + 'enrolments': [ + { + 'notificationType': 'EMAIL', + 'occurrence': { + 'amountOfSeats': 50, + 'remainingSeats': 35, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 15, + 'seatsTaken': 15, + 'startTime': '2020-01-06T00:00:00+00:00' }, - "status": "APPROVED", - "studyGroup": {"unitName": "To be created group"}, + 'status': 'APPROVED', + 'studyGroup': { + 'unitName': 'To be created group' + } } ] } } } -snapshots[ - "test_auto_accept_message_is_used_as_custom_message_in_auto_approved_enrolments[True] 1" -] = { - "data": { - "enrolOccurrence": { - "enrolments": [ +snapshots['test_auto_accept_message_is_used_as_custom_message_in_auto_approved_enrolments[True] 1'] = { + 'data': { + 'enrolOccurrence': { + 'enrolments': [ { - "notificationType": "EMAIL", - "occurrence": { - "amountOfSeats": 50, - "remainingSeats": 35, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 15, - "seatsTaken": 15, - "startTime": "2020-01-06T00:00:00+00:00", + 'notificationType': 'EMAIL', + 'occurrence': { + 'amountOfSeats': 50, + 'remainingSeats': 35, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 15, + 'seatsTaken': 15, + 'startTime': '2020-01-06T00:00:00+00:00' }, - "status": "APPROVED", - "studyGroup": {"unitName": "To be created group"}, + 'status': 'APPROVED', + 'studyGroup': { + 'unitName': 'To be created group' + } } ] } } } -snapshots[ - "test_auto_accept_message_is_used_as_custom_message_in_auto_approved_enrolments[True] 2" -] = [ - """no-reply@hel.ninja|['hutchinsonrachel@example.org']|Enrolment approved FI| +snapshots['test_auto_accept_message_is_used_as_custom_message_in_auto_approved_enrolments[True] 2'] = [ + '''no-reply@hel.ninja|['hutchinsonrachel@example.org']|Enrolment approved FI| Event FI: Raija Malka & Kaija Saariaho: Blick Extra event info: EOTtw Study group: To be created group @@ -282,553 +379,733 @@ Person: hutchinsonrachel@example.org Custom message: Testing auto acceptance message -""" +''' ] -snapshots["test_cancel_enrolment_mutation 1"] = { - "data": {"cancelEnrolment": {"enrolment": {"status": "CANCELLED"}}} +snapshots['test_cancel_enrolment_mutation 1'] = { + 'data': { + 'cancelEnrolment': { + 'enrolment': { + 'status': 'CANCELLED' + } + } + } } -snapshots["test_cancel_enrolment_query 1"] = { - "data": { - "cancellingEnrolment": { - "enrolmentTime": "2020-01-04T00:00:00+00:00", - "occurrence": {"seatsTaken": 2}, - "status": "PENDING", - "studyGroup": { - "groupSize": 2, - "unitName": "Tough plant traditional after born up always. Return student light a point charge.", +snapshots['test_cancel_enrolment_query 1'] = { + 'data': { + 'cancellingEnrolment': { + 'enrolmentTime': '2020-01-04T00:00:00+00:00', + 'occurrence': { + 'seatsTaken': 229 }, + 'status': 'PENDING', + 'studyGroup': { + 'groupSize': 229, + 'unitName': 'Campaign college career fight data. Generation man process white visit step.' + } } } } -snapshots["test_cancel_occurrence 1"] = { - "data": {"cancelOccurrence": {"occurrence": {"cancelled": True}}} +snapshots['test_cancel_occurrence 1'] = { + 'data': { + 'cancelOccurrence': { + 'occurrence': { + 'cancelled': True + } + } + } } -snapshots["test_decline_enrolment 1"] = { - "data": {"declineEnrolment": {"enrolment": {"status": "DECLINED"}}} +snapshots['test_decline_enrolment 1'] = { + 'data': { + 'declineEnrolment': { + 'enrolment': { + 'status': 'DECLINED' + } + } + } } -snapshots["test_decline_enrolment 2"] = [ - """no-reply@hel.ninja|['barrettjason@example.org']|Enrolment declined FI| +snapshots['test_decline_enrolment 2'] = [ + '''no-reply@hel.ninja|['kimberlyshort@example.org']|Enrolment declined FI| Event FI: Raija Malka & Kaija Saariaho: Blick Extra event info: VFlOj - Study group: Build natural middle however. + Study group: Leave serve important probably. Sea something western research. Occurrence: 06.01.2020 02.00 - Person: barrettjason@example.org + Person: kimberlyshort@example.org -""", - """no-reply@hel.ninja|['barrettjason@example.org']|Enrolment declined FI| +''', + '''no-reply@hel.ninja|['kimberlyshort@example.org']|Enrolment declined FI| Event FI: Raija Malka & Kaija Saariaho: Blick Extra event info: VFlOj - Study group: Build natural middle however. + Study group: Leave serve important probably. Sea something western research. Occurrence: 06.01.2020 02.00 - Person: barrettjason@example.org + Person: kimberlyshort@example.org -""", +''' ] -snapshots["test_decline_enrolment_with_custom_message 1"] = { - "data": {"declineEnrolment": {"enrolment": {"status": "DECLINED"}}} +snapshots['test_decline_enrolment_with_custom_message 1'] = { + 'data': { + 'declineEnrolment': { + 'enrolment': { + 'status': 'DECLINED' + } + } + } } -snapshots["test_decline_enrolment_with_custom_message 2"] = [ - """no-reply@hel.ninja|['barrettjason@example.org']|Enrolment declined FI| +snapshots['test_decline_enrolment_with_custom_message 2'] = [ + '''no-reply@hel.ninja|['kimberlyshort@example.org']|Enrolment declined FI| Event FI: Raija Malka & Kaija Saariaho: Blick - Extra event info: UUsgD - Study group: Build natural middle however. + Extra event info: MYfOB + Study group: Leave serve important probably. Sea something western research. Occurrence: 06.01.2020 02.00 - Person: barrettjason@example.org + Person: kimberlyshort@example.org Custom message: custom message -""" +''' ] -snapshots["test_delete_cancelled_occurrence 1"] = { - "data": {"deleteOccurrence": {"__typename": "DeleteOccurrenceMutationPayload"}} +snapshots['test_delete_cancelled_occurrence 1'] = { + 'data': { + 'deleteOccurrence': { + '__typename': 'DeleteOccurrenceMutationPayload' + } + } } -snapshots["test_delete_unpublished_occurrence 1"] = { - "data": {"deleteOccurrence": {"__typename": "DeleteOccurrenceMutationPayload"}} +snapshots['test_delete_unpublished_occurrence 1'] = { + 'data': { + 'deleteOccurrence': { + '__typename': 'DeleteOccurrenceMutationPayload' + } + } } -snapshots["test_enrol_auto_acceptance_occurrence 1"] = { - "data": { - "enrolOccurrence": { - "enrolments": [ +snapshots['test_enrol_auto_acceptance_occurrence 1'] = { + 'data': { + 'enrolOccurrence': { + 'enrolments': [ { - "notificationType": "EMAIL", - "occurrence": { - "amountOfSeats": 50, - "remainingSeats": 35, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 0, - "seatsTaken": 15, - "startTime": "2020-01-06T00:00:00+00:00", + 'notificationType': 'EMAIL', + 'occurrence': { + 'amountOfSeats': 50, + 'remainingSeats': 35, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 0, + 'seatsTaken': 15, + 'startTime': '2020-01-06T00:00:00+00:00' }, - "status": "PENDING", - "studyGroup": {"unitName": "To be created group"}, + 'status': 'PENDING', + 'studyGroup': { + 'unitName': 'To be created group' + } } ] } } } -snapshots["test_enrol_auto_acceptance_occurrence 2"] = { - "data": { - "enrolOccurrence": { - "enrolments": [ +snapshots['test_enrol_auto_acceptance_occurrence 2'] = { + 'data': { + 'enrolOccurrence': { + 'enrolments': [ { - "notificationType": "EMAIL", - "occurrence": { - "amountOfSeats": 50, - "remainingSeats": 35, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 15, - "seatsTaken": 15, - "startTime": "2020-01-06T00:00:00+00:00", + 'notificationType': 'EMAIL', + 'occurrence': { + 'amountOfSeats': 50, + 'remainingSeats': 35, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 15, + 'seatsTaken': 15, + 'startTime': '2020-01-06T00:00:00+00:00' }, - "status": "APPROVED", - "studyGroup": {"unitName": "To be created group"}, + 'status': 'APPROVED', + 'studyGroup': { + 'unitName': 'To be created group' + } } ] } } } -snapshots["test_enrol_event_queue_mutation 1"] = { - "data": { - "enrolEventQueue": { - "eventQueueEnrolment": { - "notificationType": "EMAIL_SMS", - "pEvent": { - "autoAcceptance": False, - "contactEmail": "patriciacervantes@example.net", - "contactPhoneNumber": "001-990-132-3213x16804", - "enrolmentEndDays": 2, - "enrolmentStart": "2020-01-01T02:17:13+00:00", - "externalEnrolmentUrl": None, - "isQueueingAllowed": True, - "linkedEventId": "kSRpd", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 2, - }, - "status": "HAS_NO_ENROLMENTS", - "studyGroup": { - "preferredTimes": "Only tuesdays", - "unitName": "To be created group", - }, +snapshots['test_enrol_event_queue_mutation 1'] = { + 'data': { + 'enrolEventQueue': { + 'eventQueueEnrolment': { + 'notificationType': 'EMAIL_SMS', + 'pEvent': { + 'autoAcceptance': False, + 'contactEmail': 'patriciacervantes@example.net', + 'contactPhoneNumber': '001-299-601-3232x13168', + 'enrolmentEndDays': 2, + 'enrolmentStart': '2019-09-02T23:09:06.027297+00:00', + 'externalEnrolmentUrl': None, + 'isQueueingAllowed': True, + 'linkedEventId': 'kSRpd', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 2 + }, + 'status': 'HAS_NO_ENROLMENTS', + 'studyGroup': { + 'preferredTimes': 'Only tuesdays', + 'unitName': 'To be created group' + } } } } } -snapshots["test_enrol_occurrence 1"] = { - "data": { - "enrolOccurrence": { - "enrolments": [ +snapshots['test_enrol_occurrence 1'] = { + 'data': { + 'enrolOccurrence': { + 'enrolments': [ { - "notificationType": "EMAIL", - "occurrence": { - "amountOfSeats": 50, - "remainingSeats": 35, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 0, - "seatsTaken": 15, - "startTime": "2020-01-06T00:00:00+00:00", - }, - "status": "PENDING", - "studyGroup": {"unitName": "To be created group"}, - }, - { - "notificationType": "EMAIL", - "occurrence": { - "amountOfSeats": 2, - "remainingSeats": 1, - "seatType": "ENROLMENT_COUNT", - "seatsApproved": 0, - "seatsTaken": 1, - "startTime": "2020-01-06T00:00:00+00:00", + 'notificationType': 'EMAIL', + 'occurrence': { + 'amountOfSeats': 50, + 'remainingSeats': 35, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 0, + 'seatsTaken': 15, + 'startTime': '2020-01-06T00:00:00+00:00' }, - "status": "PENDING", - "studyGroup": {"unitName": "To be created group"}, + 'status': 'PENDING', + 'studyGroup': { + 'unitName': 'To be created group' + } }, + { + 'notificationType': 'EMAIL', + 'occurrence': { + 'amountOfSeats': 2, + 'remainingSeats': 1, + 'seatType': 'ENROLMENT_COUNT', + 'seatsApproved': 0, + 'seatsTaken': 1, + 'startTime': '2020-01-06T00:00:00+00:00' + }, + 'status': 'PENDING', + 'studyGroup': { + 'unitName': 'To be created group' + } + } ] } } } -snapshots["test_enrol_occurrence_with_captcha 1"] = { - "data": { - "enrolOccurrence": { - "enrolments": [ +snapshots['test_enrol_occurrence_with_captcha 1'] = { + 'data': { + 'enrolOccurrence': { + 'enrolments': [ { - "notificationType": "EMAIL", - "occurrence": { - "amountOfSeats": 50, - "remainingSeats": 35, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 0, - "seatsTaken": 15, - "startTime": "2020-01-06T00:00:00+00:00", + 'notificationType': 'EMAIL', + 'occurrence': { + 'amountOfSeats': 50, + 'remainingSeats': 35, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 0, + 'seatsTaken': 15, + 'startTime': '2020-01-06T00:00:00+00:00' }, - "status": "PENDING", - "studyGroup": {"unitName": "To be created group"}, + 'status': 'PENDING', + 'studyGroup': { + 'unitName': 'To be created group' + } } ] } } } -snapshots["test_enrolment_query 1"] = { - "data": { - "enrolment": { - "occurrence": { - "endTime": "2011-01-01T08:53:32+00:00", - "pEvent": {"linkedEventId": "YLspj"}, - "seatsTaken": 374, - "startTime": "2000-06-09T14:31:53+00:00", +snapshots['test_enrolment_query 1'] = { + 'data': { + 'enrolment': { + 'occurrence': { + 'endTime': '1984-08-14T21:37:50.965825+00:00', + 'pEvent': { + 'linkedEventId': 'rBcjT' + }, + 'seatsTaken': 838, + 'startTime': '1976-10-26T19:45:30.627463+00:00' }, - "status": "PENDING", - "studyGroup": {"groupName": "Conference thing much like test."}, + 'status': 'PENDING', + 'studyGroup': { + 'groupName': 'Hot identify each its general. By garden so country past involve choose.' + } } } } -snapshots["test_enrolments_summary 1"] = { - "data": { - "enrolmentSummary": { - "count": 4, - "edges": [ - {"node": {"status": "APPROVED"}}, - {"node": {"status": "CANCELLED"}}, - {"node": {"status": "DECLINED"}}, - {"node": {"status": "PENDING"}}, - ], +snapshots['test_enrolments_summary 1'] = { + 'data': { + 'enrolmentSummary': { + 'count': 4, + 'edges': [ + { + 'node': { + 'status': 'APPROVED' + } + }, + { + 'node': { + 'status': 'CANCELLED' + } + }, + { + 'node': { + 'status': 'DECLINED' + } + }, + { + 'node': { + 'status': 'PENDING' + } + } + ] } } } -snapshots["test_enrolments_summary 2"] = { - "data": { - "enrolmentSummary": {"count": 1, "edges": [{"node": {"status": "APPROVED"}}]} +snapshots['test_enrolments_summary 2'] = { + 'data': { + 'enrolmentSummary': { + 'count': 1, + 'edges': [ + { + 'node': { + 'status': 'APPROVED' + } + } + ] + } } } -snapshots["test_enrolments_summary 3"] = { - "data": { - "enrolmentSummary": {"count": 1, "edges": [{"node": {"status": "PENDING"}}]} +snapshots['test_enrolments_summary 3'] = { + 'data': { + 'enrolmentSummary': { + 'count': 1, + 'edges': [ + { + 'node': { + 'status': 'PENDING' + } + } + ] + } } } -snapshots["test_enrolments_summary 4"] = { - "data": { - "enrolmentSummary": {"count": 1, "edges": [{"node": {"status": "CANCELLED"}}]} +snapshots['test_enrolments_summary 4'] = { + 'data': { + 'enrolmentSummary': { + 'count': 1, + 'edges': [ + { + 'node': { + 'status': 'CANCELLED' + } + } + ] + } } } -snapshots["test_enrolments_summary 5"] = { - "data": { - "enrolmentSummary": {"count": 1, "edges": [{"node": {"status": "DECLINED"}}]} +snapshots['test_enrolments_summary 5'] = { + 'data': { + 'enrolmentSummary': { + 'count': 1, + 'edges': [ + { + 'node': { + 'status': 'DECLINED' + } + } + ] + } } } -snapshots["test_event_queue_enrolment_query 1"] = { - "data": { - "eventQueueEnrolment": { - "pEvent": {"isQueueingAllowed": True, "linkedEventId": "twlFn"}, - "status": "HAS_NO_ENROLMENTS", - "studyGroup": { - "groupName": "Six feel real fast.", - "preferredTimes": "Put list thus Mrs cell store.", +snapshots['test_event_queue_enrolment_query 1'] = { + 'data': { + 'eventQueueEnrolment': { + 'pEvent': { + 'isQueueingAllowed': True, + 'linkedEventId': 'GVbfW' }, + 'status': 'HAS_NO_ENROLMENTS', + 'studyGroup': { + 'groupName': 'Close term where up notice environment father stay. Hold project month similar support line.', + 'preferredTimes': 'Only drug follow research.' + } } } } -snapshots["test_event_queue_enrolments_query 1"] = { - "data": { - "eventQueueEnrolments": { - "count": 15, - "edges": [ +snapshots['test_event_queue_enrolments_query 1'] = { + 'data': { + 'eventQueueEnrolments': { + 'count': 15, + 'edges': [ { - "cursor": "YXJyYXljb25uZWN0aW9uOjA=", - "node": { - "pEvent": { - "isQueueingAllowed": True, - "linkedEventId": "twlFn", - "organisation": {"name": "Graves and Sons"}, - }, - "status": "HAS_NO_ENROLMENTS", - "studyGroup": { - "groupName": "Send many different attack return. Indeed blood full door system hot.", - "preferredTimes": "Option by style seek east.", + 'cursor': 'YXJyYXljb25uZWN0aW9uOjA=', + 'node': { + 'pEvent': { + 'isQueueingAllowed': True, + 'linkedEventId': 'GVbfW', + 'organisation': { + 'name': 'Graves and Sons' + } }, - }, + 'status': 'HAS_NO_ENROLMENTS', + 'studyGroup': { + 'groupName': 'Hotel event already college. Ok court type hit.', + 'preferredTimes': 'Fund nor white identify.' + } + } }, { - "cursor": "YXJyYXljb25uZWN0aW9uOjE=", - "node": { - "pEvent": { - "isQueueingAllowed": True, - "linkedEventId": "twlFn", - "organisation": {"name": "Graves and Sons"}, - }, - "status": "HAS_NO_ENROLMENTS", - "studyGroup": { - "groupName": "Project hope eight week still. Mission program point piece simple too walk. Talk hand price author.", - "preferredTimes": "On performance detail sure.", + 'cursor': 'YXJyYXljb25uZWN0aW9uOjE=', + 'node': { + 'pEvent': { + 'isQueueingAllowed': True, + 'linkedEventId': 'GVbfW', + 'organisation': { + 'name': 'Graves and Sons' + } }, - }, + 'status': 'HAS_NO_ENROLMENTS', + 'studyGroup': { + 'groupName': '''Apply somebody especially far. Color price environmental. +Market him beyond.''', + 'preferredTimes': 'Pattern administration early.' + } + } }, { - "cursor": "YXJyYXljb25uZWN0aW9uOjI=", - "node": { - "pEvent": { - "isQueueingAllowed": True, - "linkedEventId": "twlFn", - "organisation": {"name": "Graves and Sons"}, - }, - "status": "HAS_NO_ENROLMENTS", - "studyGroup": { - "groupName": "Card support wait clearly.", - "preferredTimes": "Ago include poor example.", + 'cursor': 'YXJyYXljb25uZWN0aW9uOjI=', + 'node': { + 'pEvent': { + 'isQueueingAllowed': True, + 'linkedEventId': 'GVbfW', + 'organisation': { + 'name': 'Graves and Sons' + } }, - }, + 'status': 'HAS_NO_ENROLMENTS', + 'studyGroup': { + 'groupName': 'Reach ask I cut ok. Perhaps teacher involve all my improve our Congress.', + 'preferredTimes': 'Future upon a key fast white.' + } + } }, { - "cursor": "YXJyYXljb25uZWN0aW9uOjM=", - "node": { - "pEvent": { - "isQueueingAllowed": True, - "linkedEventId": "twlFn", - "organisation": {"name": "Graves and Sons"}, - }, - "status": "HAS_NO_ENROLMENTS", - "studyGroup": { - "groupName": "The threat organization check may available. Offer much discuss.", - "preferredTimes": "Range seek turn how.", + 'cursor': 'YXJyYXljb25uZWN0aW9uOjM=', + 'node': { + 'pEvent': { + 'isQueueingAllowed': True, + 'linkedEventId': 'GVbfW', + 'organisation': { + 'name': 'Graves and Sons' + } }, - }, + 'status': 'HAS_NO_ENROLMENTS', + 'studyGroup': { + 'groupName': 'Space oil painting. Cut region decade hold point firm. Interesting technology group.', + 'preferredTimes': 'Defense field east.' + } + } }, { - "cursor": "YXJyYXljb25uZWN0aW9uOjQ=", - "node": { - "pEvent": { - "isQueueingAllowed": True, - "linkedEventId": "twlFn", - "organisation": {"name": "Graves and Sons"}, - }, - "status": "HAS_NO_ENROLMENTS", - "studyGroup": { - "groupName": "Before charge difficult number. Leave part and test benefit.", - "preferredTimes": "Hotel near deal.", + 'cursor': 'YXJyYXljb25uZWN0aW9uOjQ=', + 'node': { + 'pEvent': { + 'isQueueingAllowed': True, + 'linkedEventId': 'GVbfW', + 'organisation': { + 'name': 'Graves and Sons' + } }, - }, + 'status': 'HAS_NO_ENROLMENTS', + 'studyGroup': { + 'groupName': 'Offer record quite window station. And natural seven. Hit performance daughter.', + 'preferredTimes': 'Home argue way all moment.' + } + } }, { - "cursor": "YXJyYXljb25uZWN0aW9uOjU=", - "node": { - "pEvent": { - "isQueueingAllowed": True, - "linkedEventId": "twlFn", - "organisation": {"name": "Graves and Sons"}, - }, - "status": "HAS_NO_ENROLMENTS", - "studyGroup": { - "groupName": "Away watch above bad car. List short color produce include threat.", - "preferredTimes": "Street sign education field.", + 'cursor': 'YXJyYXljb25uZWN0aW9uOjU=', + 'node': { + 'pEvent': { + 'isQueueingAllowed': True, + 'linkedEventId': 'GVbfW', + 'organisation': { + 'name': 'Graves and Sons' + } }, - }, + 'status': 'HAS_NO_ENROLMENTS', + 'studyGroup': { + 'groupName': 'Yeah rock evening player. According however energy large change history.', + 'preferredTimes': 'Leg ready building.' + } + } }, { - "cursor": "YXJyYXljb25uZWN0aW9uOjY=", - "node": { - "pEvent": { - "isQueueingAllowed": True, - "linkedEventId": "twlFn", - "organisation": {"name": "Graves and Sons"}, - }, - "status": "HAS_NO_ENROLMENTS", - "studyGroup": { - "groupName": "Consumer miss sense remember. House senior popular end.", - "preferredTimes": "Site score center.", + 'cursor': 'YXJyYXljb25uZWN0aW9uOjY=', + 'node': { + 'pEvent': { + 'isQueueingAllowed': True, + 'linkedEventId': 'GVbfW', + 'organisation': { + 'name': 'Graves and Sons' + } }, - }, + 'status': 'HAS_NO_ENROLMENTS', + 'studyGroup': { + 'groupName': 'Peace relationship hear increase us. Population along collection though.', + 'preferredTimes': 'Pressure health design admit.' + } + } }, { - "cursor": "YXJyYXljb25uZWN0aW9uOjc=", - "node": { - "pEvent": { - "isQueueingAllowed": True, - "linkedEventId": "twlFn", - "organisation": {"name": "Graves and Sons"}, - }, - "status": "HAS_NO_ENROLMENTS", - "studyGroup": { - "groupName": "Friend clear focus operation its bar anyone he.", - "preferredTimes": "Yes back traditional.", + 'cursor': 'YXJyYXljb25uZWN0aW9uOjc=', + 'node': { + 'pEvent': { + 'isQueueingAllowed': True, + 'linkedEventId': 'GVbfW', + 'organisation': { + 'name': 'Graves and Sons' + } }, - }, + 'status': 'HAS_NO_ENROLMENTS', + 'studyGroup': { + 'groupName': 'Simple spend decade born. Day range age.', + 'preferredTimes': 'Image identify and.' + } + } }, { - "cursor": "YXJyYXljb25uZWN0aW9uOjg=", - "node": { - "pEvent": { - "isQueueingAllowed": True, - "linkedEventId": "twlFn", - "organisation": {"name": "Graves and Sons"}, - }, - "status": "HAS_NO_ENROLMENTS", - "studyGroup": { - "groupName": "Simple spend decade born. Day range age.", - "preferredTimes": "Image identify and.", + 'cursor': 'YXJyYXljb25uZWN0aW9uOjg=', + 'node': { + 'pEvent': { + 'isQueueingAllowed': True, + 'linkedEventId': 'GVbfW', + 'organisation': { + 'name': 'Graves and Sons' + } }, - }, + 'status': 'HAS_NO_ENROLMENTS', + 'studyGroup': { + 'groupName': 'Friend clear focus operation its bar anyone he.', + 'preferredTimes': 'Yes back traditional.' + } + } }, { - "cursor": "YXJyYXljb25uZWN0aW9uOjk=", - "node": { - "pEvent": { - "isQueueingAllowed": True, - "linkedEventId": "twlFn", - "organisation": {"name": "Graves and Sons"}, - }, - "status": "HAS_NO_ENROLMENTS", - "studyGroup": { - "groupName": "Discussion program clear accept edge. Word girl hard pattern produce rather.", - "preferredTimes": "Field music now study.", + 'cursor': 'YXJyYXljb25uZWN0aW9uOjk=', + 'node': { + 'pEvent': { + 'isQueueingAllowed': True, + 'linkedEventId': 'GVbfW', + 'organisation': { + 'name': 'Graves and Sons' + } }, - }, - }, - ], + 'status': 'HAS_NO_ENROLMENTS', + 'studyGroup': { + 'groupName': 'Consumer miss sense remember. House senior popular end.', + 'preferredTimes': 'Site score center.' + } + } + } + ] } } } -snapshots["test_event_queue_enrolments_query 2"] = { - "data": { - "eventQueueEnrolments": { - "count": 15, - "edges": [ +snapshots['test_event_queue_enrolments_query 2'] = { + 'data': { + 'eventQueueEnrolments': { + 'count': 15, + 'edges': [ { - "cursor": "YXJyYXljb25uZWN0aW9uOjEw", - "node": { - "pEvent": { - "isQueueingAllowed": True, - "linkedEventId": "twlFn", - "organisation": {"name": "Graves and Sons"}, - }, - "status": "HAS_NO_ENROLMENTS", - "studyGroup": { - "groupName": "Want character would. Dream entire account. If bring cut sign force future or spend.", - "preferredTimes": "Seven section partner.", + 'cursor': 'YXJyYXljb25uZWN0aW9uOjEw', + 'node': { + 'pEvent': { + 'isQueueingAllowed': True, + 'linkedEventId': 'GVbfW', + 'organisation': { + 'name': 'Graves and Sons' + } }, - }, + 'status': 'HAS_NO_ENROLMENTS', + 'studyGroup': { + 'groupName': 'Away watch above bad car. List short color produce include threat.', + 'preferredTimes': 'Street sign education field.' + } + } }, { - "cursor": "YXJyYXljb25uZWN0aW9uOjEx", - "node": { - "pEvent": { - "isQueueingAllowed": True, - "linkedEventId": "twlFn", - "organisation": {"name": "Graves and Sons"}, - }, - "status": "HAS_NO_ENROLMENTS", - "studyGroup": { - "groupName": "Garden explain ten us total industry. Conference apply blood office human of. Wish rest spring.", - "preferredTimes": "Happen maybe we contain pick.", + 'cursor': 'YXJyYXljb25uZWN0aW9uOjEx', + 'node': { + 'pEvent': { + 'isQueueingAllowed': True, + 'linkedEventId': 'GVbfW', + 'organisation': { + 'name': 'Graves and Sons' + } }, - }, + 'status': 'HAS_NO_ENROLMENTS', + 'studyGroup': { + 'groupName': 'Before charge difficult number. Leave part and test benefit.', + 'preferredTimes': 'Hotel near deal.' + } + } }, { - "cursor": "YXJyYXljb25uZWN0aW9uOjEy", - "node": { - "pEvent": { - "isQueueingAllowed": True, - "linkedEventId": "twlFn", - "organisation": {"name": "Graves and Sons"}, - }, - "status": "HAS_NO_ENROLMENTS", - "studyGroup": { - "groupName": "With hair take nation. Relate clear traditional much situation western.", - "preferredTimes": "Authority thus step walk.", + 'cursor': 'YXJyYXljb25uZWN0aW9uOjEy', + 'node': { + 'pEvent': { + 'isQueueingAllowed': True, + 'linkedEventId': 'GVbfW', + 'organisation': { + 'name': 'Graves and Sons' + } }, - }, + 'status': 'HAS_NO_ENROLMENTS', + 'studyGroup': { + 'groupName': 'The threat organization check may available. Offer much discuss.', + 'preferredTimes': 'Range seek turn how.' + } + } }, { - "cursor": "YXJyYXljb25uZWN0aW9uOjEz", - "node": { - "pEvent": { - "isQueueingAllowed": True, - "linkedEventId": "twlFn", - "organisation": {"name": "Graves and Sons"}, - }, - "status": "HAS_NO_ENROLMENTS", - "studyGroup": { - "groupName": "Resource set feeling within Mr total learn.", - "preferredTimes": "Increase player power over.", + 'cursor': 'YXJyYXljb25uZWN0aW9uOjEz', + 'node': { + 'pEvent': { + 'isQueueingAllowed': True, + 'linkedEventId': 'GVbfW', + 'organisation': { + 'name': 'Graves and Sons' + } }, - }, + 'status': 'HAS_NO_ENROLMENTS', + 'studyGroup': { + 'groupName': 'Card support wait clearly.', + 'preferredTimes': 'Ago include poor example.' + } + } }, { - "cursor": "YXJyYXljb25uZWN0aW9uOjE0", - "node": { - "pEvent": { - "isQueueingAllowed": True, - "linkedEventId": "twlFn", - "organisation": {"name": "Graves and Sons"}, - }, - "status": "HAS_NO_ENROLMENTS", - "studyGroup": { - "groupName": "Policy parent toward apply see on send in. Full three especially card animal recognize stock.", - "preferredTimes": "Employee safe media get all.", + 'cursor': 'YXJyYXljb25uZWN0aW9uOjE0', + 'node': { + 'pEvent': { + 'isQueueingAllowed': True, + 'linkedEventId': 'GVbfW', + 'organisation': { + 'name': 'Graves and Sons' + } }, - }, - }, - ], + 'status': 'HAS_NO_ENROLMENTS', + 'studyGroup': { + 'groupName': 'Project hope eight week still. Mission program point piece simple too walk. Talk hand price author.', + 'preferredTimes': 'On performance detail sure.' + } + } + } + ] } } } -snapshots["test_language_query 1"] = { - "data": {"language": {"id": "aAVEavNlmo", "name": "Him question stay."}} +snapshots['test_language_query 1'] = { + 'data': { + 'language': { + 'id': 'aAVEavNlmo', + 'name': 'Him question stay.' + } + } } -snapshots["test_languagess_query 1"] = { - "data": { - "languages": { - "edges": [ - {"node": {"id": "ar", "name": "Arabic"}}, - {"node": {"id": "zh_hans", "name": "Chinese"}}, - {"node": {"id": "en", "name": "English"}}, - {"node": {"id": "fi", "name": "Finnish"}}, - {"node": {"id": "aAVEavNlmo", "name": "Him question stay."}}, - {"node": {"id": "ru", "name": "Russia"}}, - {"node": {"id": "sv", "name": "Swedish"}}, +snapshots['test_languages_query 1'] = { + 'data': { + 'languages': { + 'edges': [ + { + 'node': { + 'id': 'ar', + 'name': 'Arabic' + } + }, + { + 'node': { + 'id': 'zh_hans', + 'name': 'Chinese' + } + }, + { + 'node': { + 'id': 'en', + 'name': 'English' + } + }, + { + 'node': { + 'id': 'fi', + 'name': 'Finnish' + } + }, + { + 'node': { + 'id': 'aAVEavNlmo', + 'name': 'Him question stay.' + } + }, + { + 'node': { + 'id': 'ru', + 'name': 'Russia' + } + }, + { + 'node': { + 'id': 'sv', + 'name': 'Swedish' + } + } ] } } } -snapshots["test_mass_approve_enrolment_mutation 1"] = { - "data": { - "massApproveEnrolments": { - "enrolments": [ - {"status": "APPROVED"}, - {"status": "APPROVED"}, - {"status": "APPROVED"}, +snapshots['test_mass_approve_enrolment_mutation 1'] = { + 'data': { + 'massApproveEnrolments': { + 'enrolments': [ + { + 'status': 'APPROVED' + }, + { + 'status': 'APPROVED' + }, + { + 'status': 'APPROVED' + } ] } } } -snapshots["test_notification_template_query 1"] = { - "data": { - "notificationTemplate": { - "customContextPreviewHtml": """

+snapshots['test_notification_template_query 1'] = { + 'data': { + 'notificationTemplate': { + 'customContextPreviewHtml': '''

Event EN: Name in english Extra event info: linked_event_id Study group: group name @@ -836,8 +1113,8 @@ Person: email@me.com Custom message: custom_message -

""", - "customContextPreviewText": """ +

''', + 'customContextPreviewText': ''' Event EN: Name in english Extra event info: linked_event_id Study group: group name @@ -845,137 +1122,154 @@ Person: email@me.com Custom message: custom_message -""", - "template": {"type": "enrolment_approved"}, +''', + 'template': { + 'type': 'enrolment_approved' + } } } } -snapshots["test_occurrence_query 1"] = { - "data": { - "occurrence": { - "amountOfSeats": 33, - "contactPersons": {"edges": []}, - "endTime": "2000-08-18T23:27:03+00:00", - "languages": {"edges": []}, - "linkedEvent": { - "name": { - "en": "Raija Malka & Kaija Saariaho: Blick", - "fi": "Raija Malka & Kaija Saariaho: Blick", - "sv": "Raija Malka & Kaija Saariaho: Blick", +snapshots['test_occurrence_query 1'] = { + 'data': { + 'occurrence': { + 'amountOfSeats': 33, + 'contactPersons': { + 'edges': [ + ] + }, + 'endTime': '1992-07-05T13:24:13.244825+00:00', + 'languages': { + 'edges': [ + ] + }, + 'linkedEvent': { + 'name': { + 'en': 'Raija Malka & Kaija Saariaho: Blick', + 'fi': 'Raija Malka & Kaija Saariaho: Blick', + 'sv': 'Raija Malka & Kaija Saariaho: Blick' } }, - "maxGroupSize": 383, - "minGroupSize": 341, - "pEvent": { - "autoAcceptance": False, - "contactEmail": "bthomas@example.org", - "contactPhoneNumber": "(064)976-3803x466", - "enrolmentEndDays": 1, - "enrolmentStart": "1971-08-19T21:08:32+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "zVxeo", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 7, + 'maxGroupSize': 383, + 'minGroupSize': 341, + 'pEvent': { + 'autoAcceptance': False, + 'contactEmail': 'eperry@example.org', + 'contactPhoneNumber': '5646976380', + 'enrolmentEndDays': 1, + 'enrolmentStart': '1989-09-01T00:34:42.824885+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'ytHjL', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 5 }, - "placeId": "Record card my. Sure sister return.", - "remainingSeats": 33, - "seatsApproved": 0, - "seatsTaken": 0, - "startTime": "2013-12-12T04:57:19+00:00", - } - } -} - -snapshots["test_occurrences_filter_by_cancelled 1"] = { - "data": { - "occurrences": { - "edges": [ - { - "node": { - "amountOfSeats": 22, - "contactPersons": {"edges": []}, - "endTime": "1989-12-24T03:25:16+00:00", - "maxGroupSize": 75, - "minGroupSize": 879, - "pEvent": { - "autoAcceptance": False, - "contactEmail": "dsellers@example.net", - "contactPhoneNumber": "345.773.5577", - "enrolmentEndDays": 2, - "enrolmentStart": "1998-07-06T01:19:12+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "aAVEa", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 3, - }, - "placeId": "Throw wrong party wall agency customer clear.", - "remainingSeats": 22, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 0, - "seatsTaken": 0, - "startTime": "1975-02-09T12:33:37+00:00", - } - }, - { - "node": { - "amountOfSeats": 48, - "contactPersons": {"edges": []}, - "endTime": "1989-06-18T13:55:21+00:00", - "maxGroupSize": 53, - "minGroupSize": 312, - "pEvent": { - "autoAcceptance": False, - "contactEmail": "dsellers@example.net", - "contactPhoneNumber": "345.773.5577", - "enrolmentEndDays": 2, - "enrolmentStart": "1998-07-06T01:19:12+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "aAVEa", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 3, - }, - "placeId": "Actually generation five training thought.", - "remainingSeats": 48, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 0, - "seatsTaken": 0, - "startTime": "2004-11-01T19:25:53+00:00", + 'placeId': 'Record card my. Sure sister return.', + 'remainingSeats': 33, + 'seatsApproved': 0, + 'seatsTaken': 0, + 'startTime': '2002-04-18T08:13:11.806335+00:00' + } + } +} + +snapshots['test_occurrences_filter_by_cancelled 1'] = { + 'data': { + 'occurrences': { + 'edges': [ + { + 'node': { + 'amountOfSeats': 48, + 'contactPersons': { + 'edges': [ + ] + }, + 'endTime': '2010-06-19T00:36:49.508200+00:00', + 'maxGroupSize': 588, + 'minGroupSize': 752, + 'pEvent': { + 'autoAcceptance': False, + 'contactEmail': 'dsellers@example.net', + 'contactPhoneNumber': '934.957.7355', + 'enrolmentEndDays': 2, + 'enrolmentStart': '1990-12-14T02:25:00.660682+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'aAVEa', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 3 + }, + 'placeId': 'Event lay yes policy data control as receive.', + 'remainingSeats': 48, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 0, + 'seatsTaken': 0, + 'startTime': '2010-05-25T07:43:10.664303+00:00' } }, + { + 'node': { + 'amountOfSeats': 27, + 'contactPersons': { + 'edges': [ + ] + }, + 'endTime': '1992-11-11T22:43:23.275974+00:00', + 'maxGroupSize': 779, + 'minGroupSize': 292, + 'pEvent': { + 'autoAcceptance': False, + 'contactEmail': 'dsellers@example.net', + 'contactPhoneNumber': '934.957.7355', + 'enrolmentEndDays': 2, + 'enrolmentStart': '1990-12-14T02:25:00.660682+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'aAVEa', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 3 + }, + 'placeId': 'Foreign go age. Thought price gas heavy affect difficult look.', + 'remainingSeats': 27, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 0, + 'seatsTaken': 0, + 'startTime': '2017-11-29T20:34:25.983420+00:00' + } + } ] } } } -snapshots["test_occurrences_filter_by_cancelled 2"] = { - "data": { - "occurrences": { - "edges": [ - { - "node": { - "amountOfSeats": 12, - "contactPersons": {"edges": []}, - "endTime": "2009-12-31T21:53:37+00:00", - "maxGroupSize": 808, - "minGroupSize": 974, - "pEvent": { - "autoAcceptance": False, - "contactEmail": "dsellers@example.net", - "contactPhoneNumber": "345.773.5577", - "enrolmentEndDays": 2, - "enrolmentStart": "1998-07-06T01:19:12+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "aAVEa", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 3, - }, - "placeId": "Think significant land especially can quite.", - "remainingSeats": 12, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 0, - "seatsTaken": 0, - "startTime": "2000-04-01T13:16:53+00:00", +snapshots['test_occurrences_filter_by_cancelled 2'] = { + 'data': { + 'occurrences': { + 'edges': [ + { + 'node': { + 'amountOfSeats': 19, + 'contactPersons': { + 'edges': [ + ] + }, + 'endTime': '1999-05-25T04:41:42.257063+00:00', + 'maxGroupSize': 808, + 'minGroupSize': 974, + 'pEvent': { + 'autoAcceptance': False, + 'contactEmail': 'dsellers@example.net', + 'contactPhoneNumber': '934.957.7355', + 'enrolmentEndDays': 2, + 'enrolmentStart': '1990-12-14T02:25:00.660682+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'aAVEa', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 3 + }, + 'placeId': 'Think significant land especially can quite.', + 'remainingSeats': 19, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 0, + 'seatsTaken': 0, + 'startTime': '1992-03-25T02:26:42.233338+00:00' } } ] @@ -983,34 +1277,37 @@ } } -snapshots["test_occurrences_filter_by_date 1"] = { - "data": { - "occurrences": { - "edges": [ - { - "node": { - "amountOfSeats": 14, - "contactPersons": {"edges": []}, - "endTime": "2000-04-01T13:16:53+00:00", - "maxGroupSize": 808, - "minGroupSize": 974, - "pEvent": { - "autoAcceptance": False, - "contactEmail": "huntveronica@example.net", - "contactPhoneNumber": "462-003-7722x18274", - "enrolmentEndDays": 2, - "enrolmentStart": "2004-09-22T07:20:17+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "Qjarq", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 9, - }, - "placeId": "Today friend maintain marriage ok thank realize.", - "remainingSeats": 14, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 0, - "seatsTaken": 0, - "startTime": "2020-01-02T00:00:00+00:00", +snapshots['test_occurrences_filter_by_date 1'] = { + 'data': { + 'occurrences': { + 'edges': [ + { + 'node': { + 'amountOfSeats': 14, + 'contactPersons': { + 'edges': [ + ] + }, + 'endTime': '1992-03-25T02:26:42.233338+00:00', + 'maxGroupSize': 808, + 'minGroupSize': 974, + 'pEvent': { + 'autoAcceptance': False, + 'contactEmail': 'huntveronica@example.net', + 'contactPhoneNumber': '946-620-0377x22182', + 'enrolmentEndDays': 2, + 'enrolmentStart': '1995-07-09T09:54:53.846489+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'Eprsb', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 9 + }, + 'placeId': 'Today friend maintain marriage ok thank realize.', + 'remainingSeats': 14, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 0, + 'seatsTaken': 0, + 'startTime': '2020-01-02T00:00:00+00:00' } } ] @@ -1018,391 +1315,430 @@ } } -snapshots["test_occurrences_filter_by_date 2"] = { - "data": { - "occurrences": { - "edges": [ - { - "node": { - "amountOfSeats": 14, - "contactPersons": {"edges": []}, - "endTime": "2000-04-01T13:16:53+00:00", - "maxGroupSize": 808, - "minGroupSize": 974, - "pEvent": { - "autoAcceptance": False, - "contactEmail": "huntveronica@example.net", - "contactPhoneNumber": "462-003-7722x18274", - "enrolmentEndDays": 2, - "enrolmentStart": "2004-09-22T07:20:17+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "Qjarq", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 9, - }, - "placeId": "Today friend maintain marriage ok thank realize.", - "remainingSeats": 14, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 0, - "seatsTaken": 0, - "startTime": "2020-01-02T00:00:00+00:00", - } - }, - { - "node": { - "amountOfSeats": 46, - "contactPersons": {"edges": []}, - "endTime": "1973-03-29T15:33:10+00:00", - "maxGroupSize": 285, - "minGroupSize": 350, - "pEvent": { - "autoAcceptance": False, - "contactEmail": "zsilva@example.org", - "contactPhoneNumber": "001-651-263-0084x6547", - "enrolmentEndDays": 2, - "enrolmentStart": "1993-11-02T08:53:37+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "jGwiN", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 10, - }, - "placeId": "Traditional whether serious sister work.", - "remainingSeats": 46, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 0, - "seatsTaken": 0, - "startTime": "2020-01-02T00:00:00+00:00", +snapshots['test_occurrences_filter_by_date 2'] = { + 'data': { + 'occurrences': { + 'edges': [ + { + 'node': { + 'amountOfSeats': 14, + 'contactPersons': { + 'edges': [ + ] + }, + 'endTime': '1992-03-25T02:26:42.233338+00:00', + 'maxGroupSize': 808, + 'minGroupSize': 974, + 'pEvent': { + 'autoAcceptance': False, + 'contactEmail': 'huntveronica@example.net', + 'contactPhoneNumber': '946-620-0377x22182', + 'enrolmentEndDays': 2, + 'enrolmentStart': '1995-07-09T09:54:53.846489+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'Eprsb', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 9 + }, + 'placeId': 'Today friend maintain marriage ok thank realize.', + 'remainingSeats': 14, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 0, + 'seatsTaken': 0, + 'startTime': '2020-01-02T00:00:00+00:00' } }, + { + 'node': { + 'amountOfSeats': 46, + 'contactPersons': { + 'edges': [ + ] + }, + 'endTime': '2009-07-11T00:51:56.453060+00:00', + 'maxGroupSize': 285, + 'minGroupSize': 350, + 'pEvent': { + 'autoAcceptance': False, + 'contactEmail': 'flowersbryan@example.net', + 'contactPhoneNumber': '(951)826-3008x4654', + 'enrolmentEndDays': 2, + 'enrolmentStart': '1987-07-08T22:18:36.505491+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'jGwiN', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 10 + }, + 'placeId': 'Traditional whether serious sister work.', + 'remainingSeats': 46, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 0, + 'seatsTaken': 0, + 'startTime': '2020-01-02T00:00:00+00:00' + } + } ] } } } -snapshots["test_occurrences_filter_by_enrollable[0-3] 1"] = { - "data": { - "occurrences": { - "edges": [ - { - "node": { - "amountOfSeats": 40, - "contactPersons": {"edges": []}, - "endTime": "2014-12-28T01:38:36+00:00", - "maxGroupSize": 749, - "minGroupSize": 958, - "pEvent": { - "autoAcceptance": False, - "contactEmail": "thompsonjessica@example.com", - "contactPhoneNumber": "001-333-457-7355x77767", - "enrolmentEndDays": 0, - "enrolmentStart": "2020-01-05T00:00:00+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "aAVEa", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 6, - }, - "placeId": "Name likely behind mission network who.", - "remainingSeats": 40, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 0, - "seatsTaken": 0, - "startTime": "2020-01-05T00:00:00+00:00", - } - }, - { - "node": { - "amountOfSeats": 2, - "contactPersons": {"edges": []}, - "endTime": "1992-11-14T16:36:36+00:00", - "maxGroupSize": 714, - "minGroupSize": 757, - "pEvent": { - "autoAcceptance": False, - "contactEmail": "thompsonjessica@example.com", - "contactPhoneNumber": "001-333-457-7355x77767", - "enrolmentEndDays": 0, - "enrolmentStart": "2020-01-05T00:00:00+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "aAVEa", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 6, - }, - "placeId": "Father boy economy the.", - "remainingSeats": 2, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 0, - "seatsTaken": 0, - "startTime": "2020-01-06T00:00:00+00:00", - } - }, - { - "node": { - "amountOfSeats": 22, - "contactPersons": {"edges": []}, - "endTime": "1991-01-06T20:05:17+00:00", - "maxGroupSize": 527, - "minGroupSize": 932, - "pEvent": { - "autoAcceptance": False, - "contactEmail": "thompsonjessica@example.com", - "contactPhoneNumber": "001-333-457-7355x77767", - "enrolmentEndDays": 0, - "enrolmentStart": "2020-01-05T00:00:00+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "aAVEa", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 6, - }, - "placeId": "Capital city sing himself yard stuff.", - "remainingSeats": 22, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 0, - "seatsTaken": 0, - "startTime": "2020-01-07T00:00:00+00:00", +snapshots['test_occurrences_filter_by_enrollable[0-3] 1'] = { + 'data': { + 'occurrences': { + 'edges': [ + { + 'node': { + 'amountOfSeats': 2, + 'contactPersons': { + 'edges': [ + ] + }, + 'endTime': '2010-02-19T15:04:08.844371+00:00', + 'maxGroupSize': 714, + 'minGroupSize': 757, + 'pEvent': { + 'autoAcceptance': False, + 'contactEmail': 'thompsonjessica@example.com', + 'contactPhoneNumber': '001-833-934-5773x55777', + 'enrolmentEndDays': 0, + 'enrolmentStart': '2020-01-05T00:00:00+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'aAVEa', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 6 + }, + 'placeId': 'Put matter benefit treat final. Father boy economy the.', + 'remainingSeats': 2, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 0, + 'seatsTaken': 0, + 'startTime': '2020-01-05T00:00:00+00:00' + } + }, + { + 'node': { + 'amountOfSeats': 37, + 'contactPersons': { + 'edges': [ + ] + }, + 'endTime': '1985-05-19T13:06:06.872667+00:00', + 'maxGroupSize': 859, + 'minGroupSize': 99, + 'pEvent': { + 'autoAcceptance': False, + 'contactEmail': 'thompsonjessica@example.com', + 'contactPhoneNumber': '001-833-934-5773x55777', + 'enrolmentEndDays': 0, + 'enrolmentStart': '2020-01-05T00:00:00+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'aAVEa', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 6 + }, + 'placeId': 'Party door better performance race story.', + 'remainingSeats': 37, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 0, + 'seatsTaken': 0, + 'startTime': '2020-01-06T00:00:00+00:00' } }, + { + 'node': { + 'amountOfSeats': 15, + 'contactPersons': { + 'edges': [ + ] + }, + 'endTime': '1987-01-08T13:32:09.032776+00:00', + 'maxGroupSize': 873, + 'minGroupSize': 799, + 'pEvent': { + 'autoAcceptance': False, + 'contactEmail': 'thompsonjessica@example.com', + 'contactPhoneNumber': '001-833-934-5773x55777', + 'enrolmentEndDays': 0, + 'enrolmentStart': '2020-01-05T00:00:00+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'aAVEa', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 6 + }, + 'placeId': 'Toward scientist service wonder everything.', + 'remainingSeats': 15, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 0, + 'seatsTaken': 0, + 'startTime': '2020-01-07T00:00:00+00:00' + } + } ] } } } -snapshots["test_occurrences_filter_by_enrollable[1-2] 1"] = { - "data": { - "occurrences": { - "edges": [ - { - "node": { - "amountOfSeats": 2, - "contactPersons": {"edges": []}, - "endTime": "1992-11-14T16:36:36+00:00", - "maxGroupSize": 714, - "minGroupSize": 757, - "pEvent": { - "autoAcceptance": False, - "contactEmail": "thompsonjessica@example.com", - "contactPhoneNumber": "001-333-457-7355x77767", - "enrolmentEndDays": 1, - "enrolmentStart": "2020-01-05T00:00:00+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "aAVEa", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 6, - }, - "placeId": "Father boy economy the.", - "remainingSeats": 2, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 0, - "seatsTaken": 0, - "startTime": "2020-01-06T00:00:00+00:00", - } - }, - { - "node": { - "amountOfSeats": 22, - "contactPersons": {"edges": []}, - "endTime": "1991-01-06T20:05:17+00:00", - "maxGroupSize": 527, - "minGroupSize": 932, - "pEvent": { - "autoAcceptance": False, - "contactEmail": "thompsonjessica@example.com", - "contactPhoneNumber": "001-333-457-7355x77767", - "enrolmentEndDays": 1, - "enrolmentStart": "2020-01-05T00:00:00+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "aAVEa", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 6, - }, - "placeId": "Capital city sing himself yard stuff.", - "remainingSeats": 22, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 0, - "seatsTaken": 0, - "startTime": "2020-01-07T00:00:00+00:00", +snapshots['test_occurrences_filter_by_enrollable[1-2] 1'] = { + 'data': { + 'occurrences': { + 'edges': [ + { + 'node': { + 'amountOfSeats': 37, + 'contactPersons': { + 'edges': [ + ] + }, + 'endTime': '1985-05-19T13:06:06.872667+00:00', + 'maxGroupSize': 859, + 'minGroupSize': 99, + 'pEvent': { + 'autoAcceptance': False, + 'contactEmail': 'thompsonjessica@example.com', + 'contactPhoneNumber': '001-833-934-5773x55777', + 'enrolmentEndDays': 1, + 'enrolmentStart': '2020-01-05T00:00:00+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'aAVEa', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 6 + }, + 'placeId': 'Party door better performance race story.', + 'remainingSeats': 37, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 0, + 'seatsTaken': 0, + 'startTime': '2020-01-06T00:00:00+00:00' } }, + { + 'node': { + 'amountOfSeats': 15, + 'contactPersons': { + 'edges': [ + ] + }, + 'endTime': '1987-01-08T13:32:09.032776+00:00', + 'maxGroupSize': 873, + 'minGroupSize': 799, + 'pEvent': { + 'autoAcceptance': False, + 'contactEmail': 'thompsonjessica@example.com', + 'contactPhoneNumber': '001-833-934-5773x55777', + 'enrolmentEndDays': 1, + 'enrolmentStart': '2020-01-05T00:00:00+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'aAVEa', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 6 + }, + 'placeId': 'Toward scientist service wonder everything.', + 'remainingSeats': 15, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 0, + 'seatsTaken': 0, + 'startTime': '2020-01-07T00:00:00+00:00' + } + } ] } } } -snapshots["test_occurrences_filter_by_enrollable[None-3] 1"] = { - "data": { - "occurrences": { - "edges": [ - { - "node": { - "amountOfSeats": 40, - "contactPersons": {"edges": []}, - "endTime": "2014-12-28T01:38:36+00:00", - "maxGroupSize": 749, - "minGroupSize": 958, - "pEvent": { - "autoAcceptance": False, - "contactEmail": "thompsonjessica@example.com", - "contactPhoneNumber": "001-333-457-7355x77767", - "enrolmentEndDays": None, - "enrolmentStart": "2020-01-05T00:00:00+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "aAVEa", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 6, - }, - "placeId": "Name likely behind mission network who.", - "remainingSeats": 40, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 0, - "seatsTaken": 0, - "startTime": "2020-01-05T00:00:00+00:00", - } - }, - { - "node": { - "amountOfSeats": 2, - "contactPersons": {"edges": []}, - "endTime": "1992-11-14T16:36:36+00:00", - "maxGroupSize": 714, - "minGroupSize": 757, - "pEvent": { - "autoAcceptance": False, - "contactEmail": "thompsonjessica@example.com", - "contactPhoneNumber": "001-333-457-7355x77767", - "enrolmentEndDays": None, - "enrolmentStart": "2020-01-05T00:00:00+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "aAVEa", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 6, - }, - "placeId": "Father boy economy the.", - "remainingSeats": 2, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 0, - "seatsTaken": 0, - "startTime": "2020-01-06T00:00:00+00:00", - } - }, - { - "node": { - "amountOfSeats": 22, - "contactPersons": {"edges": []}, - "endTime": "1991-01-06T20:05:17+00:00", - "maxGroupSize": 527, - "minGroupSize": 932, - "pEvent": { - "autoAcceptance": False, - "contactEmail": "thompsonjessica@example.com", - "contactPhoneNumber": "001-333-457-7355x77767", - "enrolmentEndDays": None, - "enrolmentStart": "2020-01-05T00:00:00+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "aAVEa", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 6, - }, - "placeId": "Capital city sing himself yard stuff.", - "remainingSeats": 22, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 0, - "seatsTaken": 0, - "startTime": "2020-01-07T00:00:00+00:00", +snapshots['test_occurrences_filter_by_enrollable[None-3] 1'] = { + 'data': { + 'occurrences': { + 'edges': [ + { + 'node': { + 'amountOfSeats': 2, + 'contactPersons': { + 'edges': [ + ] + }, + 'endTime': '2010-02-19T15:04:08.844371+00:00', + 'maxGroupSize': 714, + 'minGroupSize': 757, + 'pEvent': { + 'autoAcceptance': False, + 'contactEmail': 'thompsonjessica@example.com', + 'contactPhoneNumber': '001-833-934-5773x55777', + 'enrolmentEndDays': None, + 'enrolmentStart': '2020-01-05T00:00:00+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'aAVEa', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 6 + }, + 'placeId': 'Put matter benefit treat final. Father boy economy the.', + 'remainingSeats': 2, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 0, + 'seatsTaken': 0, + 'startTime': '2020-01-05T00:00:00+00:00' } }, + { + 'node': { + 'amountOfSeats': 37, + 'contactPersons': { + 'edges': [ + ] + }, + 'endTime': '1985-05-19T13:06:06.872667+00:00', + 'maxGroupSize': 859, + 'minGroupSize': 99, + 'pEvent': { + 'autoAcceptance': False, + 'contactEmail': 'thompsonjessica@example.com', + 'contactPhoneNumber': '001-833-934-5773x55777', + 'enrolmentEndDays': None, + 'enrolmentStart': '2020-01-05T00:00:00+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'aAVEa', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 6 + }, + 'placeId': 'Party door better performance race story.', + 'remainingSeats': 37, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 0, + 'seatsTaken': 0, + 'startTime': '2020-01-06T00:00:00+00:00' + } + }, + { + 'node': { + 'amountOfSeats': 15, + 'contactPersons': { + 'edges': [ + ] + }, + 'endTime': '1987-01-08T13:32:09.032776+00:00', + 'maxGroupSize': 873, + 'minGroupSize': 799, + 'pEvent': { + 'autoAcceptance': False, + 'contactEmail': 'thompsonjessica@example.com', + 'contactPhoneNumber': '001-833-934-5773x55777', + 'enrolmentEndDays': None, + 'enrolmentStart': '2020-01-05T00:00:00+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'aAVEa', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 6 + }, + 'placeId': 'Toward scientist service wonder everything.', + 'remainingSeats': 15, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 0, + 'seatsTaken': 0, + 'startTime': '2020-01-07T00:00:00+00:00' + } + } ] } } } -snapshots["test_occurrences_filter_by_p_event 1"] = { - "data": { - "occurrences": { - "edges": [ - { - "node": { - "amountOfSeats": 8, - "contactPersons": {"edges": []}, - "endTime": "1986-10-16T20:29:23+00:00", - "maxGroupSize": 687, - "minGroupSize": 225, - "pEvent": { - "autoAcceptance": False, - "contactEmail": "dsellers@example.net", - "contactPhoneNumber": "345.773.5577", - "enrolmentEndDays": 2, - "enrolmentStart": "1998-07-06T01:19:12+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "aAVEa", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 3, - }, - "placeId": "Light a point charge stand store.", - "remainingSeats": 8, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 0, - "seatsTaken": 0, - "startTime": "1974-10-19T15:53:39+00:00", - } - }, - { - "node": { - "amountOfSeats": 27, - "contactPersons": {"edges": []}, - "endTime": "1997-12-26T00:43:56+00:00", - "maxGroupSize": 459, - "minGroupSize": 568, - "pEvent": { - "autoAcceptance": False, - "contactEmail": "dsellers@example.net", - "contactPhoneNumber": "345.773.5577", - "enrolmentEndDays": 2, - "enrolmentStart": "1998-07-06T01:19:12+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "aAVEa", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 3, - }, - "placeId": "Chance of performance financial.", - "remainingSeats": 27, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 0, - "seatsTaken": 0, - "startTime": "1989-07-01T22:41:54+00:00", +snapshots['test_occurrences_filter_by_p_event 1'] = { + 'data': { + 'occurrences': { + 'edges': [ + { + 'node': { + 'amountOfSeats': 27, + 'contactPersons': { + 'edges': [ + ] + }, + 'endTime': '1982-11-06T05:00:33.407924+00:00', + 'maxGroupSize': 22, + 'minGroupSize': 6, + 'pEvent': { + 'autoAcceptance': False, + 'contactEmail': 'dsellers@example.net', + 'contactPhoneNumber': '934.957.7355', + 'enrolmentEndDays': 2, + 'enrolmentStart': '1990-12-14T02:25:00.660682+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'aAVEa', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 3 + }, + 'placeId': 'Need benefit ready though street.', + 'remainingSeats': 27, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 0, + 'seatsTaken': 0, + 'startTime': '2008-02-13T12:28:42.493034+00:00' } }, + { + 'node': { + 'amountOfSeats': 3, + 'contactPersons': { + 'edges': [ + ] + }, + 'endTime': '1983-12-18T04:24:52.499467+00:00', + 'maxGroupSize': 128, + 'minGroupSize': 574, + 'pEvent': { + 'autoAcceptance': False, + 'contactEmail': 'dsellers@example.net', + 'contactPhoneNumber': '934.957.7355', + 'enrolmentEndDays': 2, + 'enrolmentStart': '1990-12-14T02:25:00.660682+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'aAVEa', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 3 + }, + 'placeId': 'Course plant strong truth customer.', + 'remainingSeats': 3, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 0, + 'seatsTaken': 0, + 'startTime': '2009-08-12T10:24:07.768068+00:00' + } + } ] } } } -snapshots["test_occurrences_filter_by_p_event 2"] = { - "data": { - "occurrences": { - "edges": [ - { - "node": { - "amountOfSeats": 45, - "contactPersons": {"edges": []}, - "endTime": "1978-10-04T07:23:05+00:00", - "maxGroupSize": 464, - "minGroupSize": 526, - "pEvent": { - "autoAcceptance": False, - "contactEmail": "jonathan20@example.org", - "contactPhoneNumber": "001-779-340-5555x089", - "enrolmentEndDays": 2, - "enrolmentStart": "2017-02-20T07:43:47+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "rzzET", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 6, - }, - "placeId": "Old affect quite.", - "remainingSeats": 45, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 0, - "seatsTaken": 0, - "startTime": "1971-10-08T22:49:29+00:00", +snapshots['test_occurrences_filter_by_p_event 2'] = { + 'data': { + 'occurrences': { + 'edges': [ + { + 'node': { + 'amountOfSeats': 49, + 'contactPersons': { + 'edges': [ + ] + }, + 'endTime': '1975-07-12T08:22:11.536273+00:00', + 'maxGroupSize': 990, + 'minGroupSize': 749, + 'pEvent': { + 'autoAcceptance': False, + 'contactEmail': 'cmartin@example.org', + 'contactPhoneNumber': '+1-777-693-4055x5508', + 'enrolmentEndDays': 1, + 'enrolmentStart': '2004-08-22T06:31:59.521157+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'rzzET', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 10 + }, + 'placeId': 'End look once strong artist save. Run hand human value base.', + 'remainingSeats': 49, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 0, + 'seatsTaken': 0, + 'startTime': '2018-10-22T00:06:45.180823+00:00' } } ] @@ -1410,34 +1746,37 @@ } } -snapshots["test_occurrences_filter_by_time 1"] = { - "data": { - "occurrences": { - "edges": [ - { - "node": { - "amountOfSeats": 33, - "contactPersons": {"edges": []}, - "endTime": "2013-12-12T04:57:19+00:00", - "maxGroupSize": 383, - "minGroupSize": 341, - "pEvent": { - "autoAcceptance": False, - "contactEmail": "eduncan@example.org", - "contactPhoneNumber": "(750)649-7638x0346", - "enrolmentEndDays": 2, - "enrolmentStart": "1988-11-29T04:01:36+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "OzVxe", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 0, - }, - "placeId": "Record card my. Sure sister return.", - "remainingSeats": 33, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 0, - "seatsTaken": 0, - "startTime": "2020-01-01T10:00:00+00:00", +snapshots['test_occurrences_filter_by_time 1'] = { + 'data': { + 'occurrences': { + 'edges': [ + { + 'node': { + 'amountOfSeats': 33, + 'contactPersons': { + 'edges': [ + ] + }, + 'endTime': '2002-04-18T08:13:11.806335+00:00', + 'maxGroupSize': 383, + 'minGroupSize': 341, + 'pEvent': { + 'autoAcceptance': False, + 'contactEmail': 'bthomas@example.org', + 'contactPhoneNumber': '(806)849-7638x034', + 'enrolmentEndDays': 1, + 'enrolmentStart': '2006-07-17T09:52:28.440059+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'xytHj', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 7 + }, + 'placeId': 'Record card my. Sure sister return.', + 'remainingSeats': 33, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 0, + 'seatsTaken': 0, + 'startTime': '2020-01-01T10:00:00+00:00' } } ] @@ -1445,34 +1784,37 @@ } } -snapshots["test_occurrences_filter_by_time 2"] = { - "data": { - "occurrences": { - "edges": [ - { - "node": { - "amountOfSeats": 24, - "contactPersons": {"edges": []}, - "endTime": "1970-05-06T08:51:57+00:00", - "maxGroupSize": 288, - "minGroupSize": 67, - "pEvent": { - "autoAcceptance": False, - "contactEmail": "pwilliams@example.org", - "contactPhoneNumber": "377.940.2178x77950", - "enrolmentEndDays": 2, - "enrolmentStart": "2005-08-24T18:22:59+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "nVTDE", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 3, - }, - "placeId": "Few eye first walk west six feel. Fast authority key crime.", - "remainingSeats": 24, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 0, - "seatsTaken": 0, - "startTime": "2020-01-02T12:00:00+00:00", +snapshots['test_occurrences_filter_by_time 2'] = { + 'data': { + 'occurrences': { + 'edges': [ + { + 'node': { + 'amountOfSeats': 24, + 'contactPersons': { + 'edges': [ + ] + }, + 'endTime': '1970-04-03T02:38:45.929522+00:00', + 'maxGroupSize': 288, + 'minGroupSize': 67, + 'pEvent': { + 'autoAcceptance': False, + 'contactEmail': 'pwilliams@example.org', + 'contactPhoneNumber': '737.279.4021x78779', + 'enrolmentEndDays': 2, + 'enrolmentStart': '2007-04-19T19:01:37.637441+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'Tfgkj', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 3 + }, + 'placeId': 'Few eye first walk west six feel. Fast authority key crime.', + 'remainingSeats': 24, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 0, + 'seatsTaken': 0, + 'startTime': '2020-01-02T12:00:00+00:00' } } ] @@ -1480,591 +1822,651 @@ } } -snapshots["test_occurrences_filter_by_time 3"] = { - "data": { - "occurrences": { - "edges": [ - { - "node": { - "amountOfSeats": 46, - "contactPersons": {"edges": []}, - "endTime": "1973-03-29T15:33:10+00:00", - "maxGroupSize": 285, - "minGroupSize": 350, - "pEvent": { - "autoAcceptance": False, - "contactEmail": "zsilva@example.org", - "contactPhoneNumber": "001-651-263-0084x6547", - "enrolmentEndDays": 2, - "enrolmentStart": "1993-11-02T08:53:37+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "jGwiN", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 10, - }, - "placeId": "Traditional whether serious sister work.", - "remainingSeats": 46, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 0, - "seatsTaken": 0, - "startTime": "2020-01-01T11:00:00+00:00", - } - }, - { - "node": { - "amountOfSeats": 14, - "contactPersons": {"edges": []}, - "endTime": "2000-04-01T13:16:53+00:00", - "maxGroupSize": 808, - "minGroupSize": 974, - "pEvent": { - "autoAcceptance": False, - "contactEmail": "huntveronica@example.net", - "contactPhoneNumber": "462-003-7722x18274", - "enrolmentEndDays": 2, - "enrolmentStart": "2004-09-22T07:20:17+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "Qjarq", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 9, - }, - "placeId": "Today friend maintain marriage ok thank realize.", - "remainingSeats": 14, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 0, - "seatsTaken": 0, - "startTime": "2020-01-02T11:00:00+00:00", +snapshots['test_occurrences_filter_by_time 3'] = { + 'data': { + 'occurrences': { + 'edges': [ + { + 'node': { + 'amountOfSeats': 46, + 'contactPersons': { + 'edges': [ + ] + }, + 'endTime': '2009-07-11T00:51:56.453060+00:00', + 'maxGroupSize': 285, + 'minGroupSize': 350, + 'pEvent': { + 'autoAcceptance': False, + 'contactEmail': 'flowersbryan@example.net', + 'contactPhoneNumber': '(951)826-3008x4654', + 'enrolmentEndDays': 2, + 'enrolmentStart': '1987-07-08T22:18:36.505491+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'jGwiN', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 10 + }, + 'placeId': 'Traditional whether serious sister work.', + 'remainingSeats': 46, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 0, + 'seatsTaken': 0, + 'startTime': '2020-01-01T11:00:00+00:00' } }, + { + 'node': { + 'amountOfSeats': 14, + 'contactPersons': { + 'edges': [ + ] + }, + 'endTime': '1992-03-25T02:26:42.233338+00:00', + 'maxGroupSize': 808, + 'minGroupSize': 974, + 'pEvent': { + 'autoAcceptance': False, + 'contactEmail': 'huntveronica@example.net', + 'contactPhoneNumber': '946-620-0377x22182', + 'enrolmentEndDays': 2, + 'enrolmentStart': '1995-07-09T09:54:53.846489+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'Eprsb', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 9 + }, + 'placeId': 'Today friend maintain marriage ok thank realize.', + 'remainingSeats': 14, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 0, + 'seatsTaken': 0, + 'startTime': '2020-01-02T11:00:00+00:00' + } + } ] } } } -snapshots["test_occurrences_filter_by_time 4"] = { - "data": { - "occurrences": { - "edges": [ - { - "node": { - "amountOfSeats": 46, - "contactPersons": {"edges": []}, - "endTime": "1973-03-29T15:33:10+00:00", - "maxGroupSize": 285, - "minGroupSize": 350, - "pEvent": { - "autoAcceptance": False, - "contactEmail": "zsilva@example.org", - "contactPhoneNumber": "001-651-263-0084x6547", - "enrolmentEndDays": 2, - "enrolmentStart": "1993-11-02T08:53:37+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "jGwiN", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 10, - }, - "placeId": "Traditional whether serious sister work.", - "remainingSeats": 46, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 0, - "seatsTaken": 0, - "startTime": "2020-01-01T11:00:00+00:00", - } - }, - { - "node": { - "amountOfSeats": 14, - "contactPersons": {"edges": []}, - "endTime": "2000-04-01T13:16:53+00:00", - "maxGroupSize": 808, - "minGroupSize": 974, - "pEvent": { - "autoAcceptance": False, - "contactEmail": "huntveronica@example.net", - "contactPhoneNumber": "462-003-7722x18274", - "enrolmentEndDays": 2, - "enrolmentStart": "2004-09-22T07:20:17+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "Qjarq", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 9, - }, - "placeId": "Today friend maintain marriage ok thank realize.", - "remainingSeats": 14, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 0, - "seatsTaken": 0, - "startTime": "2020-01-02T11:00:00+00:00", +snapshots['test_occurrences_filter_by_time 4'] = { + 'data': { + 'occurrences': { + 'edges': [ + { + 'node': { + 'amountOfSeats': 46, + 'contactPersons': { + 'edges': [ + ] + }, + 'endTime': '2009-07-11T00:51:56.453060+00:00', + 'maxGroupSize': 285, + 'minGroupSize': 350, + 'pEvent': { + 'autoAcceptance': False, + 'contactEmail': 'flowersbryan@example.net', + 'contactPhoneNumber': '(951)826-3008x4654', + 'enrolmentEndDays': 2, + 'enrolmentStart': '1987-07-08T22:18:36.505491+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'jGwiN', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 10 + }, + 'placeId': 'Traditional whether serious sister work.', + 'remainingSeats': 46, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 0, + 'seatsTaken': 0, + 'startTime': '2020-01-01T11:00:00+00:00' } }, + { + 'node': { + 'amountOfSeats': 14, + 'contactPersons': { + 'edges': [ + ] + }, + 'endTime': '1992-03-25T02:26:42.233338+00:00', + 'maxGroupSize': 808, + 'minGroupSize': 974, + 'pEvent': { + 'autoAcceptance': False, + 'contactEmail': 'huntveronica@example.net', + 'contactPhoneNumber': '946-620-0377x22182', + 'enrolmentEndDays': 2, + 'enrolmentStart': '1995-07-09T09:54:53.846489+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'Eprsb', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 9 + }, + 'placeId': 'Today friend maintain marriage ok thank realize.', + 'remainingSeats': 14, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 0, + 'seatsTaken': 0, + 'startTime': '2020-01-02T11:00:00+00:00' + } + } ] } } } -snapshots["test_occurrences_filter_by_upcoming 1"] = { - "data": { - "occurrences": { - "edges": [ - { - "node": { - "amountOfSeats": 32, - "contactPersons": {"edges": []}, - "endTime": "2020-01-05T00:00:00+00:00", - "maxGroupSize": 53, - "minGroupSize": 312, - "pEvent": { - "autoAcceptance": False, - "contactEmail": "thompsonjessica@example.com", - "contactPhoneNumber": "001-333-457-7355x77767", - "enrolmentEndDays": 10, - "enrolmentStart": "2020-01-05T00:00:00+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "aAVEa", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 6, - }, - "placeId": "Staff country actually generation five training.", - "remainingSeats": 32, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 0, - "seatsTaken": 0, - "startTime": "2020-01-04T00:00:00+00:00", - } - }, - { - "node": { - "amountOfSeats": 41, - "contactPersons": {"edges": []}, - "endTime": "2020-01-06T00:00:00+00:00", - "maxGroupSize": 1000, - "minGroupSize": 984, - "pEvent": { - "autoAcceptance": False, - "contactEmail": "thompsonjessica@example.com", - "contactPhoneNumber": "001-333-457-7355x77767", - "enrolmentEndDays": 10, - "enrolmentStart": "2020-01-05T00:00:00+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "aAVEa", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 6, - }, - "placeId": "Senior number scene today friend maintain marriage.", - "remainingSeats": 41, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 0, - "seatsTaken": 0, - "startTime": "2020-01-05T00:00:00+00:00", - } - }, - { - "node": { - "amountOfSeats": 1, - "contactPersons": {"edges": []}, - "endTime": "2020-01-07T00:00:00+00:00", - "maxGroupSize": 557, - "minGroupSize": 345, - "pEvent": { - "autoAcceptance": False, - "contactEmail": "thompsonjessica@example.com", - "contactPhoneNumber": "001-333-457-7355x77767", - "enrolmentEndDays": 10, - "enrolmentStart": "2020-01-05T00:00:00+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "aAVEa", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 6, - }, - "placeId": "Central situation past ready join enjoy.", - "remainingSeats": 1, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 0, - "seatsTaken": 0, - "startTime": "2020-01-06T00:00:00+00:00", +snapshots['test_occurrences_filter_by_upcoming 1'] = { + 'data': { + 'occurrences': { + 'edges': [ + { + 'node': { + 'amountOfSeats': 43, + 'contactPersons': { + 'edges': [ + ] + }, + 'endTime': '2020-01-05T00:00:00+00:00', + 'maxGroupSize': 709, + 'minGroupSize': 132, + 'pEvent': { + 'autoAcceptance': False, + 'contactEmail': 'thompsonjessica@example.com', + 'contactPhoneNumber': '001-833-934-5773x55777', + 'enrolmentEndDays': 10, + 'enrolmentStart': '2020-01-05T00:00:00+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'aAVEa', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 6 + }, + 'placeId': 'Success commercial recently from front affect senior.', + 'remainingSeats': 43, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 0, + 'seatsTaken': 0, + 'startTime': '2020-01-04T00:00:00+00:00' } }, + { + 'node': { + 'amountOfSeats': 22, + 'contactPersons': { + 'edges': [ + ] + }, + 'endTime': '2020-01-06T00:00:00+00:00', + 'maxGroupSize': 407, + 'minGroupSize': 589, + 'pEvent': { + 'autoAcceptance': False, + 'contactEmail': 'thompsonjessica@example.com', + 'contactPhoneNumber': '001-833-934-5773x55777', + 'enrolmentEndDays': 10, + 'enrolmentStart': '2020-01-05T00:00:00+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'aAVEa', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 6 + }, + 'placeId': 'Option PM put matter benefit.', + 'remainingSeats': 22, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 0, + 'seatsTaken': 0, + 'startTime': '2020-01-05T00:00:00+00:00' + } + }, + { + 'node': { + 'amountOfSeats': 19, + 'contactPersons': { + 'edges': [ + ] + }, + 'endTime': '2020-01-07T00:00:00+00:00', + 'maxGroupSize': 859, + 'minGroupSize': 99, + 'pEvent': { + 'autoAcceptance': False, + 'contactEmail': 'thompsonjessica@example.com', + 'contactPhoneNumber': '001-833-934-5773x55777', + 'enrolmentEndDays': 10, + 'enrolmentStart': '2020-01-05T00:00:00+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'aAVEa', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 6 + }, + 'placeId': 'Dream party door better performance race story.', + 'remainingSeats': 19, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 0, + 'seatsTaken': 0, + 'startTime': '2020-01-06T00:00:00+00:00' + } + } ] } } } -snapshots["test_occurrences_ordering_by_order_by_end_time 1"] = { - "data": { - "occurrences": { - "edges": [ - { - "node": { - "amountOfSeats": 46, - "contactPersons": {"edges": []}, - "endTime": "2020-01-05T00:00:00+00:00", - "maxGroupSize": 285, - "minGroupSize": 350, - "pEvent": { - "autoAcceptance": False, - "contactEmail": "zsilva@example.org", - "contactPhoneNumber": "001-651-263-0084x6547", - "enrolmentEndDays": 2, - "enrolmentStart": "1993-11-02T08:53:37+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "jGwiN", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 10, - }, - "placeId": "Traditional whether serious sister work.", - "remainingSeats": 46, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 0, - "seatsTaken": 0, - "startTime": "1973-03-29T15:33:10+00:00", - } - }, - { - "node": { - "amountOfSeats": 33, - "contactPersons": {"edges": []}, - "endTime": "2020-01-06T00:00:00+00:00", - "maxGroupSize": 383, - "minGroupSize": 341, - "pEvent": { - "autoAcceptance": False, - "contactEmail": "eduncan@example.org", - "contactPhoneNumber": "(750)649-7638x0346", - "enrolmentEndDays": 2, - "enrolmentStart": "1988-11-29T04:01:36+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "OzVxe", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 0, - }, - "placeId": "Record card my. Sure sister return.", - "remainingSeats": 33, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 0, - "seatsTaken": 0, - "startTime": "2013-12-12T04:57:19+00:00", - } - }, - { - "node": { - "amountOfSeats": 14, - "contactPersons": {"edges": []}, - "endTime": "2020-01-07T00:00:00+00:00", - "maxGroupSize": 808, - "minGroupSize": 974, - "pEvent": { - "autoAcceptance": False, - "contactEmail": "huntveronica@example.net", - "contactPhoneNumber": "462-003-7722x18274", - "enrolmentEndDays": 2, - "enrolmentStart": "2004-09-22T07:20:17+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "Qjarq", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 9, - }, - "placeId": "Today friend maintain marriage ok thank realize.", - "remainingSeats": 14, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 0, - "seatsTaken": 0, - "startTime": "2000-04-01T13:16:53+00:00", +snapshots['test_occurrences_ordering_by_order_by_end_time 1'] = { + 'data': { + 'occurrences': { + 'edges': [ + { + 'node': { + 'amountOfSeats': 46, + 'contactPersons': { + 'edges': [ + ] + }, + 'endTime': '2020-01-05T00:00:00+00:00', + 'maxGroupSize': 285, + 'minGroupSize': 350, + 'pEvent': { + 'autoAcceptance': False, + 'contactEmail': 'flowersbryan@example.net', + 'contactPhoneNumber': '(951)826-3008x4654', + 'enrolmentEndDays': 2, + 'enrolmentStart': '1987-07-08T22:18:36.505491+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'jGwiN', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 10 + }, + 'placeId': 'Traditional whether serious sister work.', + 'remainingSeats': 46, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 0, + 'seatsTaken': 0, + 'startTime': '2009-07-11T00:51:56.453060+00:00' } }, + { + 'node': { + 'amountOfSeats': 33, + 'contactPersons': { + 'edges': [ + ] + }, + 'endTime': '2020-01-06T00:00:00+00:00', + 'maxGroupSize': 383, + 'minGroupSize': 341, + 'pEvent': { + 'autoAcceptance': False, + 'contactEmail': 'bthomas@example.org', + 'contactPhoneNumber': '(806)849-7638x034', + 'enrolmentEndDays': 1, + 'enrolmentStart': '2006-07-17T09:52:28.440059+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'xytHj', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 7 + }, + 'placeId': 'Record card my. Sure sister return.', + 'remainingSeats': 33, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 0, + 'seatsTaken': 0, + 'startTime': '2002-04-18T08:13:11.806335+00:00' + } + }, + { + 'node': { + 'amountOfSeats': 14, + 'contactPersons': { + 'edges': [ + ] + }, + 'endTime': '2020-01-07T00:00:00+00:00', + 'maxGroupSize': 808, + 'minGroupSize': 974, + 'pEvent': { + 'autoAcceptance': False, + 'contactEmail': 'huntveronica@example.net', + 'contactPhoneNumber': '946-620-0377x22182', + 'enrolmentEndDays': 2, + 'enrolmentStart': '1995-07-09T09:54:53.846489+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'Eprsb', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 9 + }, + 'placeId': 'Today friend maintain marriage ok thank realize.', + 'remainingSeats': 14, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 0, + 'seatsTaken': 0, + 'startTime': '1992-03-25T02:26:42.233338+00:00' + } + } ] } } } -snapshots["test_occurrences_ordering_by_order_by_end_time 2"] = { - "data": { - "occurrences": { - "edges": [ - { - "node": { - "amountOfSeats": 14, - "contactPersons": {"edges": []}, - "endTime": "2020-01-07T00:00:00+00:00", - "maxGroupSize": 808, - "minGroupSize": 974, - "pEvent": { - "autoAcceptance": False, - "contactEmail": "huntveronica@example.net", - "contactPhoneNumber": "462-003-7722x18274", - "enrolmentEndDays": 2, - "enrolmentStart": "2004-09-22T07:20:17+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "Qjarq", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 9, - }, - "placeId": "Today friend maintain marriage ok thank realize.", - "remainingSeats": 14, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 0, - "seatsTaken": 0, - "startTime": "2000-04-01T13:16:53+00:00", - } - }, - { - "node": { - "amountOfSeats": 33, - "contactPersons": {"edges": []}, - "endTime": "2020-01-06T00:00:00+00:00", - "maxGroupSize": 383, - "minGroupSize": 341, - "pEvent": { - "autoAcceptance": False, - "contactEmail": "eduncan@example.org", - "contactPhoneNumber": "(750)649-7638x0346", - "enrolmentEndDays": 2, - "enrolmentStart": "1988-11-29T04:01:36+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "OzVxe", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 0, - }, - "placeId": "Record card my. Sure sister return.", - "remainingSeats": 33, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 0, - "seatsTaken": 0, - "startTime": "2013-12-12T04:57:19+00:00", - } - }, - { - "node": { - "amountOfSeats": 46, - "contactPersons": {"edges": []}, - "endTime": "2020-01-05T00:00:00+00:00", - "maxGroupSize": 285, - "minGroupSize": 350, - "pEvent": { - "autoAcceptance": False, - "contactEmail": "zsilva@example.org", - "contactPhoneNumber": "001-651-263-0084x6547", - "enrolmentEndDays": 2, - "enrolmentStart": "1993-11-02T08:53:37+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "jGwiN", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 10, - }, - "placeId": "Traditional whether serious sister work.", - "remainingSeats": 46, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 0, - "seatsTaken": 0, - "startTime": "1973-03-29T15:33:10+00:00", +snapshots['test_occurrences_ordering_by_order_by_end_time 2'] = { + 'data': { + 'occurrences': { + 'edges': [ + { + 'node': { + 'amountOfSeats': 14, + 'contactPersons': { + 'edges': [ + ] + }, + 'endTime': '2020-01-07T00:00:00+00:00', + 'maxGroupSize': 808, + 'minGroupSize': 974, + 'pEvent': { + 'autoAcceptance': False, + 'contactEmail': 'huntveronica@example.net', + 'contactPhoneNumber': '946-620-0377x22182', + 'enrolmentEndDays': 2, + 'enrolmentStart': '1995-07-09T09:54:53.846489+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'Eprsb', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 9 + }, + 'placeId': 'Today friend maintain marriage ok thank realize.', + 'remainingSeats': 14, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 0, + 'seatsTaken': 0, + 'startTime': '1992-03-25T02:26:42.233338+00:00' } }, + { + 'node': { + 'amountOfSeats': 33, + 'contactPersons': { + 'edges': [ + ] + }, + 'endTime': '2020-01-06T00:00:00+00:00', + 'maxGroupSize': 383, + 'minGroupSize': 341, + 'pEvent': { + 'autoAcceptance': False, + 'contactEmail': 'bthomas@example.org', + 'contactPhoneNumber': '(806)849-7638x034', + 'enrolmentEndDays': 1, + 'enrolmentStart': '2006-07-17T09:52:28.440059+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'xytHj', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 7 + }, + 'placeId': 'Record card my. Sure sister return.', + 'remainingSeats': 33, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 0, + 'seatsTaken': 0, + 'startTime': '2002-04-18T08:13:11.806335+00:00' + } + }, + { + 'node': { + 'amountOfSeats': 46, + 'contactPersons': { + 'edges': [ + ] + }, + 'endTime': '2020-01-05T00:00:00+00:00', + 'maxGroupSize': 285, + 'minGroupSize': 350, + 'pEvent': { + 'autoAcceptance': False, + 'contactEmail': 'flowersbryan@example.net', + 'contactPhoneNumber': '(951)826-3008x4654', + 'enrolmentEndDays': 2, + 'enrolmentStart': '1987-07-08T22:18:36.505491+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'jGwiN', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 10 + }, + 'placeId': 'Traditional whether serious sister work.', + 'remainingSeats': 46, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 0, + 'seatsTaken': 0, + 'startTime': '2009-07-11T00:51:56.453060+00:00' + } + } ] } } } -snapshots["test_occurrences_ordering_by_order_by_start_time 1"] = { - "data": { - "occurrences": { - "edges": [ - { - "node": { - "amountOfSeats": 46, - "contactPersons": {"edges": []}, - "endTime": "1973-03-29T15:33:10+00:00", - "maxGroupSize": 285, - "minGroupSize": 350, - "pEvent": { - "autoAcceptance": False, - "contactEmail": "zsilva@example.org", - "contactPhoneNumber": "001-651-263-0084x6547", - "enrolmentEndDays": 2, - "enrolmentStart": "1993-11-02T08:53:37+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "jGwiN", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 10, - }, - "placeId": "Traditional whether serious sister work.", - "remainingSeats": 46, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 0, - "seatsTaken": 0, - "startTime": "2020-01-05T00:00:00+00:00", - } - }, - { - "node": { - "amountOfSeats": 33, - "contactPersons": {"edges": []}, - "endTime": "2013-12-12T04:57:19+00:00", - "maxGroupSize": 383, - "minGroupSize": 341, - "pEvent": { - "autoAcceptance": False, - "contactEmail": "eduncan@example.org", - "contactPhoneNumber": "(750)649-7638x0346", - "enrolmentEndDays": 2, - "enrolmentStart": "1988-11-29T04:01:36+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "OzVxe", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 0, - }, - "placeId": "Record card my. Sure sister return.", - "remainingSeats": 33, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 0, - "seatsTaken": 0, - "startTime": "2020-01-06T00:00:00+00:00", - } - }, - { - "node": { - "amountOfSeats": 14, - "contactPersons": {"edges": []}, - "endTime": "2000-04-01T13:16:53+00:00", - "maxGroupSize": 808, - "minGroupSize": 974, - "pEvent": { - "autoAcceptance": False, - "contactEmail": "huntveronica@example.net", - "contactPhoneNumber": "462-003-7722x18274", - "enrolmentEndDays": 2, - "enrolmentStart": "2004-09-22T07:20:17+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "Qjarq", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 9, - }, - "placeId": "Today friend maintain marriage ok thank realize.", - "remainingSeats": 14, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 0, - "seatsTaken": 0, - "startTime": "2020-01-07T00:00:00+00:00", +snapshots['test_occurrences_ordering_by_order_by_start_time 1'] = { + 'data': { + 'occurrences': { + 'edges': [ + { + 'node': { + 'amountOfSeats': 46, + 'contactPersons': { + 'edges': [ + ] + }, + 'endTime': '2009-07-11T00:51:56.453060+00:00', + 'maxGroupSize': 285, + 'minGroupSize': 350, + 'pEvent': { + 'autoAcceptance': False, + 'contactEmail': 'flowersbryan@example.net', + 'contactPhoneNumber': '(951)826-3008x4654', + 'enrolmentEndDays': 2, + 'enrolmentStart': '1987-07-08T22:18:36.505491+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'jGwiN', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 10 + }, + 'placeId': 'Traditional whether serious sister work.', + 'remainingSeats': 46, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 0, + 'seatsTaken': 0, + 'startTime': '2020-01-05T00:00:00+00:00' } }, + { + 'node': { + 'amountOfSeats': 33, + 'contactPersons': { + 'edges': [ + ] + }, + 'endTime': '2002-04-18T08:13:11.806335+00:00', + 'maxGroupSize': 383, + 'minGroupSize': 341, + 'pEvent': { + 'autoAcceptance': False, + 'contactEmail': 'bthomas@example.org', + 'contactPhoneNumber': '(806)849-7638x034', + 'enrolmentEndDays': 1, + 'enrolmentStart': '2006-07-17T09:52:28.440059+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'xytHj', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 7 + }, + 'placeId': 'Record card my. Sure sister return.', + 'remainingSeats': 33, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 0, + 'seatsTaken': 0, + 'startTime': '2020-01-06T00:00:00+00:00' + } + }, + { + 'node': { + 'amountOfSeats': 14, + 'contactPersons': { + 'edges': [ + ] + }, + 'endTime': '1992-03-25T02:26:42.233338+00:00', + 'maxGroupSize': 808, + 'minGroupSize': 974, + 'pEvent': { + 'autoAcceptance': False, + 'contactEmail': 'huntveronica@example.net', + 'contactPhoneNumber': '946-620-0377x22182', + 'enrolmentEndDays': 2, + 'enrolmentStart': '1995-07-09T09:54:53.846489+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'Eprsb', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 9 + }, + 'placeId': 'Today friend maintain marriage ok thank realize.', + 'remainingSeats': 14, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 0, + 'seatsTaken': 0, + 'startTime': '2020-01-07T00:00:00+00:00' + } + } ] } } } -snapshots["test_occurrences_ordering_by_order_by_start_time 2"] = { - "data": { - "occurrences": { - "edges": [ - { - "node": { - "amountOfSeats": 14, - "contactPersons": {"edges": []}, - "endTime": "2000-04-01T13:16:53+00:00", - "maxGroupSize": 808, - "minGroupSize": 974, - "pEvent": { - "autoAcceptance": False, - "contactEmail": "huntveronica@example.net", - "contactPhoneNumber": "462-003-7722x18274", - "enrolmentEndDays": 2, - "enrolmentStart": "2004-09-22T07:20:17+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "Qjarq", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 9, - }, - "placeId": "Today friend maintain marriage ok thank realize.", - "remainingSeats": 14, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 0, - "seatsTaken": 0, - "startTime": "2020-01-07T00:00:00+00:00", - } - }, - { - "node": { - "amountOfSeats": 33, - "contactPersons": {"edges": []}, - "endTime": "2013-12-12T04:57:19+00:00", - "maxGroupSize": 383, - "minGroupSize": 341, - "pEvent": { - "autoAcceptance": False, - "contactEmail": "eduncan@example.org", - "contactPhoneNumber": "(750)649-7638x0346", - "enrolmentEndDays": 2, - "enrolmentStart": "1988-11-29T04:01:36+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "OzVxe", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 0, - }, - "placeId": "Record card my. Sure sister return.", - "remainingSeats": 33, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 0, - "seatsTaken": 0, - "startTime": "2020-01-06T00:00:00+00:00", - } - }, - { - "node": { - "amountOfSeats": 46, - "contactPersons": {"edges": []}, - "endTime": "1973-03-29T15:33:10+00:00", - "maxGroupSize": 285, - "minGroupSize": 350, - "pEvent": { - "autoAcceptance": False, - "contactEmail": "zsilva@example.org", - "contactPhoneNumber": "001-651-263-0084x6547", - "enrolmentEndDays": 2, - "enrolmentStart": "1993-11-02T08:53:37+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "jGwiN", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 10, - }, - "placeId": "Traditional whether serious sister work.", - "remainingSeats": 46, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 0, - "seatsTaken": 0, - "startTime": "2020-01-05T00:00:00+00:00", +snapshots['test_occurrences_ordering_by_order_by_start_time 2'] = { + 'data': { + 'occurrences': { + 'edges': [ + { + 'node': { + 'amountOfSeats': 14, + 'contactPersons': { + 'edges': [ + ] + }, + 'endTime': '1992-03-25T02:26:42.233338+00:00', + 'maxGroupSize': 808, + 'minGroupSize': 974, + 'pEvent': { + 'autoAcceptance': False, + 'contactEmail': 'huntveronica@example.net', + 'contactPhoneNumber': '946-620-0377x22182', + 'enrolmentEndDays': 2, + 'enrolmentStart': '1995-07-09T09:54:53.846489+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'Eprsb', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 9 + }, + 'placeId': 'Today friend maintain marriage ok thank realize.', + 'remainingSeats': 14, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 0, + 'seatsTaken': 0, + 'startTime': '2020-01-07T00:00:00+00:00' + } + }, + { + 'node': { + 'amountOfSeats': 33, + 'contactPersons': { + 'edges': [ + ] + }, + 'endTime': '2002-04-18T08:13:11.806335+00:00', + 'maxGroupSize': 383, + 'minGroupSize': 341, + 'pEvent': { + 'autoAcceptance': False, + 'contactEmail': 'bthomas@example.org', + 'contactPhoneNumber': '(806)849-7638x034', + 'enrolmentEndDays': 1, + 'enrolmentStart': '2006-07-17T09:52:28.440059+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'xytHj', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 7 + }, + 'placeId': 'Record card my. Sure sister return.', + 'remainingSeats': 33, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 0, + 'seatsTaken': 0, + 'startTime': '2020-01-06T00:00:00+00:00' } }, + { + 'node': { + 'amountOfSeats': 46, + 'contactPersons': { + 'edges': [ + ] + }, + 'endTime': '2009-07-11T00:51:56.453060+00:00', + 'maxGroupSize': 285, + 'minGroupSize': 350, + 'pEvent': { + 'autoAcceptance': False, + 'contactEmail': 'flowersbryan@example.net', + 'contactPhoneNumber': '(951)826-3008x4654', + 'enrolmentEndDays': 2, + 'enrolmentStart': '1987-07-08T22:18:36.505491+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'jGwiN', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 10 + }, + 'placeId': 'Traditional whether serious sister work.', + 'remainingSeats': 46, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 0, + 'seatsTaken': 0, + 'startTime': '2020-01-05T00:00:00+00:00' + } + } ] } } } -snapshots["test_occurrences_query 1"] = { - "data": { - "occurrences": { - "edges": [ - { - "node": { - "amountOfSeats": 33, - "contactPersons": {"edges": []}, - "endTime": "2000-08-18T23:27:03+00:00", - "maxGroupSize": 383, - "minGroupSize": 341, - "pEvent": { - "autoAcceptance": False, - "contactEmail": "bthomas@example.org", - "contactPhoneNumber": "(064)976-3803x466", - "enrolmentEndDays": 1, - "enrolmentStart": "1971-08-19T21:08:32+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "zVxeo", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 7, - }, - "placeId": "Record card my. Sure sister return.", - "remainingSeats": 33, - "seatType": "CHILDREN_COUNT", - "seatsApproved": 0, - "seatsTaken": 0, - "startTime": "2013-12-12T04:57:19+00:00", +snapshots['test_occurrences_query 1'] = { + 'data': { + 'occurrences': { + 'edges': [ + { + 'node': { + 'amountOfSeats': 33, + 'contactPersons': { + 'edges': [ + ] + }, + 'endTime': '1992-07-05T13:24:13.244825+00:00', + 'maxGroupSize': 383, + 'minGroupSize': 341, + 'pEvent': { + 'autoAcceptance': False, + 'contactEmail': 'eperry@example.org', + 'contactPhoneNumber': '5646976380', + 'enrolmentEndDays': 1, + 'enrolmentStart': '1989-09-01T00:34:42.824885+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'ytHjL', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 5 + }, + 'placeId': 'Record card my. Sure sister return.', + 'remainingSeats': 33, + 'seatType': 'CHILDREN_COUNT', + 'seatsApproved': 0, + 'seatsTaken': 0, + 'startTime': '2002-04-18T08:13:11.806335+00:00' } } ] @@ -2072,451 +2474,590 @@ } } -snapshots["test_pick_enrolment_from_queue 1"] = { - "data": { - "pickEnrolmentFromQueue": { - "enrolment": { - "notificationType": "EMAIL", - "person": {"emailAddress": "david26@example.net", "name": "Julie Wolf"}, - "status": "PENDING", - "studyGroup": {"groupName": "Six feel real fast."}, +snapshots['test_pick_enrolment_from_queue 1'] = { + 'data': { + 'pickEnrolmentFromQueue': { + 'enrolment': { + 'notificationType': 'EMAIL', + 'person': { + 'emailAddress': 'rose06@example.com', + 'name': 'Robert Gray' + }, + 'status': 'PENDING', + 'studyGroup': { + 'groupName': 'Decade address have turn serve me every traditional. Sound describe risk newspaper reflect four.' + } } } } } -snapshots["test_study_level_query 1"] = { - "data": { - "studyLevel": { - "id": "age_0_2", - "label": "age 0-2", - "level": 0, - "translations": [{"label": "age 0-2", "languageCode": "EN"}], +snapshots['test_study_level_query 1'] = { + 'data': { + 'studyLevel': { + 'id': 'age_0_2', + 'label': 'age 0-2', + 'level': 0, + 'translations': [ + { + 'label': 'age 0-2', + 'languageCode': 'EN' + } + ] } } } -snapshots["test_study_levels_query 1"] = { - "data": { - "studyLevels": { - "edges": [ +snapshots['test_study_levels_query 1'] = { + 'data': { + 'studyLevels': { + 'edges': [ { - "node": { - "id": "age_0_2", - "label": "age 0-2", - "level": 0, - "translations": [{"label": "age 0-2", "languageCode": "EN"}], + 'node': { + 'id': 'age_0_2', + 'label': 'age 0-2', + 'level': 0, + 'translations': [ + { + 'label': 'age 0-2', + 'languageCode': 'EN' + } + ] } }, { - "node": { - "id": "age_3_4", - "label": "age 3-4", - "level": 1, - "translations": [{"label": "age 3-4", "languageCode": "EN"}], + 'node': { + 'id': 'age_3_4', + 'label': 'age 3-4', + 'level': 1, + 'translations': [ + { + 'label': 'age 3-4', + 'languageCode': 'EN' + } + ] } }, { - "node": { - "id": "preschool", - "label": "preschool", - "level": 2, - "translations": [{"label": "preschool", "languageCode": "EN"}], + 'node': { + 'id': 'preschool', + 'label': 'preschool', + 'level': 2, + 'translations': [ + { + 'label': 'preschool', + 'languageCode': 'EN' + } + ] } }, { - "node": { - "id": "grade_1", - "label": "first grade", - "level": 3, - "translations": [ - {"label": "first grade", "languageCode": "EN"} - ], + 'node': { + 'id': 'grade_1', + 'label': 'first grade', + 'level': 3, + 'translations': [ + { + 'label': 'first grade', + 'languageCode': 'EN' + } + ] } }, { - "node": { - "id": "grade_2", - "label": "second grade", - "level": 4, - "translations": [ - {"label": "second grade", "languageCode": "EN"} - ], + 'node': { + 'id': 'grade_2', + 'label': 'second grade', + 'level': 4, + 'translations': [ + { + 'label': 'second grade', + 'languageCode': 'EN' + } + ] } }, { - "node": { - "id": "grade_3", - "label": "third grade", - "level": 5, - "translations": [ - {"label": "third grade", "languageCode": "EN"} - ], + 'node': { + 'id': 'grade_3', + 'label': 'third grade', + 'level': 5, + 'translations': [ + { + 'label': 'third grade', + 'languageCode': 'EN' + } + ] } }, { - "node": { - "id": "grade_4", - "label": "fourth grade", - "level": 6, - "translations": [ - {"label": "fourth grade", "languageCode": "EN"} - ], + 'node': { + 'id': 'grade_4', + 'label': 'fourth grade', + 'level': 6, + 'translations': [ + { + 'label': 'fourth grade', + 'languageCode': 'EN' + } + ] } }, { - "node": { - "id": "grade_5", - "label": "fifth grade", - "level": 7, - "translations": [ - {"label": "fifth grade", "languageCode": "EN"} - ], + 'node': { + 'id': 'grade_5', + 'label': 'fifth grade', + 'level': 7, + 'translations': [ + { + 'label': 'fifth grade', + 'languageCode': 'EN' + } + ] } }, { - "node": { - "id": "grade_6", - "label": "sixth grade", - "level": 8, - "translations": [ - {"label": "sixth grade", "languageCode": "EN"} - ], + 'node': { + 'id': 'grade_6', + 'label': 'sixth grade', + 'level': 8, + 'translations': [ + { + 'label': 'sixth grade', + 'languageCode': 'EN' + } + ] } }, { - "node": { - "id": "grade_7", - "label": "seventh grade", - "level": 9, - "translations": [ - {"label": "seventh grade", "languageCode": "EN"} - ], + 'node': { + 'id': 'grade_7', + 'label': 'seventh grade', + 'level': 9, + 'translations': [ + { + 'label': 'seventh grade', + 'languageCode': 'EN' + } + ] } }, { - "node": { - "id": "grade_8", - "label": "eighth grade", - "level": 10, - "translations": [ - {"label": "eighth grade", "languageCode": "EN"} - ], + 'node': { + 'id': 'grade_8', + 'label': 'eighth grade', + 'level': 10, + 'translations': [ + { + 'label': 'eighth grade', + 'languageCode': 'EN' + } + ] } }, { - "node": { - "id": "grade_9", - "label": "ninth grade", - "level": 11, - "translations": [ - {"label": "ninth grade", "languageCode": "EN"} - ], + 'node': { + 'id': 'grade_9', + 'label': 'ninth grade', + 'level': 11, + 'translations': [ + { + 'label': 'ninth grade', + 'languageCode': 'EN' + } + ] } }, { - "node": { - "id": "grade_10", - "label": "tenth grade", - "level": 12, - "translations": [ - {"label": "tenth grade", "languageCode": "EN"} - ], + 'node': { + 'id': 'grade_10', + 'label': 'tenth grade', + 'level': 12, + 'translations': [ + { + 'label': 'tenth grade', + 'languageCode': 'EN' + } + ] } }, { - "node": { - "id": "secondary", - "label": "secondary", - "level": 13, - "translations": [{"label": "secondary", "languageCode": "EN"}], + 'node': { + 'id': 'secondary', + 'label': 'secondary', + 'level': 13, + 'translations': [ + { + 'label': 'secondary', + 'languageCode': 'EN' + } + ] } }, { - "node": { - "id": "other", - "label": "other group", - "level": 14, - "translations": [ - {"label": "other group", "languageCode": "EN"} - ], + 'node': { + 'id': 'other', + 'label': 'other group', + 'level': 14, + 'translations': [ + { + 'label': 'other group', + 'languageCode': 'EN' + } + ] } - }, + } ] } } } -snapshots["test_unenrol_event_queue_mutation[False] 1"] = { - "data": { - "unenrolEventQueue": { - "pEvent": {"isQueueingAllowed": False, "linkedEventId": "MYfOB"}, - "studyGroup": { - "unitName": "Tough plant traditional after born up always. Return student light a point charge." +snapshots['test_unenrol_event_queue_mutation[False] 1'] = { + 'data': { + 'unenrolEventQueue': { + 'pEvent': { + 'isQueueingAllowed': False, + 'linkedEventId': 'MYfOB' }, + 'studyGroup': { + 'unitName': 'Tough plant traditional after born up always. Return student light a point charge.' + } } } } -snapshots["test_unenrol_event_queue_mutation[True] 1"] = { - "data": { - "unenrolEventQueue": { - "pEvent": {"isQueueingAllowed": True, "linkedEventId": "MYfOB"}, - "studyGroup": { - "unitName": "Tough plant traditional after born up always. Return student light a point charge." +snapshots['test_unenrol_event_queue_mutation[True] 1'] = { + 'data': { + 'unenrolEventQueue': { + 'pEvent': { + 'isQueueingAllowed': True, + 'linkedEventId': 'MYfOB' }, + 'studyGroup': { + 'unitName': 'Tough plant traditional after born up always. Return student light a point charge.' + } } } } -snapshots["test_unenrol_occurrence 1"] = { - "data": { - "unenrolOccurrence": { - "occurrence": { - "amountOfSeats": 50, - "remainingSeats": 50, - "seatsApproved": 0, - "seatsTaken": 0, - "startTime": "2020-01-06T00:00:00+00:00", +snapshots['test_unenrol_occurrence 1'] = { + 'data': { + 'unenrolOccurrence': { + 'occurrence': { + 'amountOfSeats': 50, + 'remainingSeats': 50, + 'seatsApproved': 0, + 'seatsTaken': 0, + 'startTime': '2020-01-06T00:00:00+00:00' }, - "studyGroup": {"unitName": "Build natural middle however."}, - } - } -} - -snapshots["test_update_enrolment 1"] = { - "data": { - "updateEnrolment": { - "enrolment": { - "notificationType": "SMS", - "occurrence": { - "amountOfSeats": 35, - "remainingSeats": 6, - "seatsApproved": 0, - "seatsTaken": 29, - "startTime": "2020-01-06T00:00:00+00:00", - }, - "status": "PENDING", - "studyGroup": { - "amountOfAdult": 3, - "enrolments": { - "edges": [ - {"node": {"notificationType": "SMS"}}, - {"node": {"notificationType": "SMS"}}, + 'studyGroup': { + 'unitName': 'Leave serve important probably. Sea something western research.' + } + } + } +} + +snapshots['test_update_enrolment 1'] = { + 'data': { + 'updateEnrolment': { + 'enrolment': { + 'notificationType': 'SMS', + 'occurrence': { + 'amountOfSeats': 35, + 'remainingSeats': 6, + 'seatsApproved': 0, + 'seatsTaken': 29, + 'startTime': '2020-01-06T00:00:00+00:00' + }, + 'status': 'PENDING', + 'studyGroup': { + 'amountOfAdult': 3, + 'enrolments': { + 'edges': [ + { + 'node': { + 'notificationType': 'SMS' + } + }, + { + 'node': { + 'notificationType': 'SMS' + } + } ] }, - "groupName": "Updated study group name", - "groupSize": 16, - "unitName": "Updated name", - }, + 'groupName': 'Updated study group name', + 'groupSize': 16, + 'unitName': 'Updated name' + } } } } } -snapshots["test_update_occurrence_of_published_event_without_enrolments 1"] = { - "data": { - "updateOccurrence": { - "occurrence": { - "contactPersons": {"edges": [{"node": {"name": "Jamie Alvarez DDS"}}]}, - "endTime": "2020-05-06T00:00:00+00:00", - "languages": { - "edges": [ - {"node": {"id": "en", "name": "English"}}, - {"node": {"id": "fi", "name": "Finnish"}}, - {"node": {"id": "sv", "name": "Swedish"}}, +snapshots['test_update_occurrence_of_published_event_without_enrolments 1'] = { + 'data': { + 'updateOccurrence': { + 'occurrence': { + 'contactPersons': { + 'edges': [ + { + 'node': { + 'name': 'Julie Parrish' + } + } + ] + }, + 'endTime': '2020-05-06T00:00:00+00:00', + 'languages': { + 'edges': [ + { + 'node': { + 'id': 'en', + 'name': 'English' + } + }, + { + 'node': { + 'id': 'fi', + 'name': 'Finnish' + } + }, + { + 'node': { + 'id': 'sv', + 'name': 'Swedish' + } + } ] }, - "maxGroupSize": 10, - "minGroupSize": 10, - "pEvent": { - "contactEmail": "erogers@example.org", - "contactPhoneNumber": "(882)540-3891x625", - "enrolmentEndDays": 0, - "enrolmentStart": "2014-07-18T09:56:19+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "helsinki:afxp6tv4xa", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 6, - }, - "startTime": "2020-05-05T00:00:00+00:00", + 'maxGroupSize': 10, + 'minGroupSize': 10, + 'pEvent': { + 'contactEmail': 'donald78@example.net', + 'contactPhoneNumber': '001-658-731-3222x29493', + 'enrolmentEndDays': 2, + 'enrolmentStart': '1981-07-25T10:13:14.019007+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'helsinki:afxp6tv4xa', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 0 + }, + 'startTime': '2020-05-05T00:00:00+00:00' } } } } -snapshots["test_update_study_group_staff_user 1"] = { - "data": { - "updateStudyGroup": { - "studyGroup": { - "amountOfAdult": 2, - "extraNeeds": "Extra needs", - "groupName": "Sample group name", - "groupSize": 20, - "person": { - "emailAddress": "email@address.com", - "language": "FI", - "name": "Name", - "phoneNumber": "123123", - }, - "studyLevels": { - "edges": [ +snapshots['test_update_study_group_staff_user 1'] = { + 'data': { + 'updateStudyGroup': { + 'studyGroup': { + 'amountOfAdult': 2, + 'extraNeeds': 'Extra needs', + 'groupName': 'Sample group name', + 'groupSize': 20, + 'person': { + 'emailAddress': 'email@address.com', + 'language': 'FI', + 'name': 'Name', + 'phoneNumber': '123123' + }, + 'studyLevels': { + 'edges': [ { - "node": { - "id": "grade_2", - "label": "second grade", - "level": 4, - "translations": [ - {"label": "second grade", "languageCode": "EN"} - ], + 'node': { + 'id': 'grade_2', + 'label': 'second grade', + 'level': 4, + 'translations': [ + { + 'label': 'second grade', + 'languageCode': 'EN' + } + ] } } ] }, - "unit": { - "internalId": "https://api.hel.fi/linkedevents/v1/place/tprek:15417/", - "name": {"fi": "Sellon kirjasto"}, + 'unit': { + 'internalId': 'https://api.hel.fi/linkedevents/v1/place/tprek:15417/', + 'name': { + 'fi': 'Sellon kirjasto' + } }, - "unitId": "helsinki:afxp6tv4xa", - "unitName": "Sample study group name", + 'unitId': 'helsinki:afxp6tv4xa', + 'unitName': 'Sample study group name' } } } } -snapshots["test_update_study_group_staff_user 2"] = { - "data": { - "updateStudyGroup": { - "studyGroup": { - "amountOfAdult": 2, - "extraNeeds": "Extra needs", - "groupName": "Sample group name", - "groupSize": 20, - "person": { - "emailAddress": "shawndouglas@example.com", - "language": "FI", - "name": "Sean Rocha", - "phoneNumber": "001-159-102-3202x81307", - }, - "studyLevels": { - "edges": [ +snapshots['test_update_study_group_staff_user 2'] = { + 'data': { + 'updateStudyGroup': { + 'studyGroup': { + 'amountOfAdult': 2, + 'extraNeeds': 'Extra needs', + 'groupName': 'Sample group name', + 'groupSize': 20, + 'person': { + 'emailAddress': 'shawndouglas@example.com', + 'language': 'FI', + 'name': 'Sean Rocha', + 'phoneNumber': '001-215-991-0232x02813' + }, + 'studyLevels': { + 'edges': [ { - "node": { - "id": "grade_2", - "label": "second grade", - "level": 4, - "translations": [ - {"label": "second grade", "languageCode": "EN"} - ], + 'node': { + 'id': 'grade_2', + 'label': 'second grade', + 'level': 4, + 'translations': [ + { + 'label': 'second grade', + 'languageCode': 'EN' + } + ] } } ] }, - "unit": { - "internalId": "https://api.hel.fi/linkedevents/v1/place/tprek:15417/", - "name": {"fi": "Sellon kirjasto"}, + 'unit': { + 'internalId': 'https://api.hel.fi/linkedevents/v1/place/tprek:15417/', + 'name': { + 'fi': 'Sellon kirjasto' + } }, - "unitId": "helsinki:afxp6tv4xa", - "unitName": "Sample study group name", + 'unitId': 'helsinki:afxp6tv4xa', + 'unitName': 'Sample study group name' } } } } -snapshots["test_update_unpublished_occurrence 1"] = { - "data": { - "updateOccurrence": { - "occurrence": { - "contactPersons": {"edges": [{"node": {"name": "Kathryn Hill"}}]}, - "endTime": "2020-05-06T00:00:00+00:00", - "languages": { - "edges": [ - {"node": {"id": "en", "name": "English"}}, - {"node": {"id": "fi", "name": "Finnish"}}, - {"node": {"id": "sv", "name": "Swedish"}}, +snapshots['test_update_unpublished_occurrence 1'] = { + 'data': { + 'updateOccurrence': { + 'occurrence': { + 'contactPersons': { + 'edges': [ + { + 'node': { + 'name': 'Julie Parrish' + } + } ] }, - "maxGroupSize": 588, - "minGroupSize": 10, - "pEvent": { - "contactEmail": "oharrell@example.org", - "contactPhoneNumber": "+1-916-259-6512", - "enrolmentEndDays": 0, - "enrolmentStart": "1988-12-31T00:41:31+00:00", - "externalEnrolmentUrl": None, - "linkedEventId": "mwrDP", - "mandatoryAdditionalInformation": False, - "neededOccurrences": 3, - }, - "startTime": "2020-05-05T00:00:00+00:00", + 'endTime': '2020-05-06T00:00:00+00:00', + 'languages': { + 'edges': [ + { + 'node': { + 'id': 'en', + 'name': 'English' + } + }, + { + 'node': { + 'id': 'fi', + 'name': 'Finnish' + } + }, + { + 'node': { + 'id': 'sv', + 'name': 'Swedish' + } + } + ] + }, + 'maxGroupSize': 588, + 'minGroupSize': 10, + 'pEvent': { + 'contactEmail': 'travishopkins@example.net', + 'contactPhoneNumber': '(722)729-4934', + 'enrolmentEndDays': 0, + 'enrolmentStart': '1980-12-30T21:50:40.750124+00:00', + 'externalEnrolmentUrl': None, + 'linkedEventId': 'raSqN', + 'mandatoryAdditionalInformation': False, + 'neededOccurrences': 3 + }, + 'startTime': '2020-05-05T00:00:00+00:00' } } } } -snapshots["test_update_venue_staff_user 1"] = { - "data": { - "updateVenue": { - "venue": { - "description": "Venue description", - "hasAreaForGroupWork": True, - "hasClothingStorage": True, - "hasIndoorPlayingArea": True, - "hasOutdoorPlayingArea": True, - "hasSnackEatingPlace": True, - "hasToiletNearby": True, - "id": "Irtal", - "outdoorActivity": True, - "translations": [ - {"description": "Venue description in EN"}, - {"description": "Venue description"}, - ], +snapshots['test_update_venue_staff_user 1'] = { + 'data': { + 'updateVenue': { + 'venue': { + 'description': 'Venue description', + 'hasAreaForGroupWork': True, + 'hasClothingStorage': True, + 'hasIndoorPlayingArea': True, + 'hasOutdoorPlayingArea': True, + 'hasSnackEatingPlace': True, + 'hasToiletNearby': True, + 'id': 'Irtal', + 'outdoorActivity': True, + 'translations': [ + { + 'description': 'Venue description' + }, + { + 'description': 'Venue description in EN' + } + ] } } } } -snapshots["test_venue_query 1"] = { - "data": { - "venue": { - "description": "Answer entire increase thank certainly again thought. Beyond than trial western.", - "hasAreaForGroupWork": False, - "hasClothingStorage": False, - "hasIndoorPlayingArea": False, - "hasOutdoorPlayingArea": False, - "hasSnackEatingPlace": True, - "hasToiletNearby": False, - "id": "PcMpy", - "outdoorActivity": False, - "translations": [ - { - "description": "Answer entire increase thank certainly again thought. Beyond than trial western." +snapshots['test_venue_query 1'] = { + 'data': { + 'venue': { + 'description': 'Answer entire increase thank certainly again thought. Beyond than trial western.', + 'hasAreaForGroupWork': False, + 'hasClothingStorage': False, + 'hasIndoorPlayingArea': False, + 'hasOutdoorPlayingArea': False, + 'hasSnackEatingPlace': True, + 'hasToiletNearby': False, + 'id': 'PcMpy', + 'outdoorActivity': False, + 'translations': [ + { + 'description': 'Answer entire increase thank certainly again thought. Beyond than trial western.' } - ], + ] } } } -snapshots["test_venues_query 1"] = { - "data": { - "venues": { - "edges": [ - { - "node": { - "description": "Answer entire increase thank certainly again thought. Beyond than trial western.", - "hasAreaForGroupWork": False, - "hasClothingStorage": False, - "hasIndoorPlayingArea": False, - "hasOutdoorPlayingArea": False, - "hasSnackEatingPlace": True, - "hasToiletNearby": False, - "id": "PcMpy", - "outdoorActivity": False, - "translations": [ +snapshots['test_venues_query 1'] = { + 'data': { + 'venues': { + 'edges': [ + { + 'node': { + 'description': 'Answer entire increase thank certainly again thought. Beyond than trial western.', + 'hasAreaForGroupWork': False, + 'hasClothingStorage': False, + 'hasIndoorPlayingArea': False, + 'hasOutdoorPlayingArea': False, + 'hasSnackEatingPlace': True, + 'hasToiletNearby': False, + 'id': 'PcMpy', + 'outdoorActivity': False, + 'translations': [ { - "description": "Answer entire increase thank certainly again thought. Beyond than trial western." + 'description': 'Answer entire increase thank certainly again thought. Beyond than trial western.' } - ], + ] } } ] diff --git a/occurrences/tests/snapshots/snap_test_notifications.py b/occurrences/tests/snapshots/snap_test_notifications.py index b855519d..7040c97c 100644 --- a/occurrences/tests/snapshots/snap_test_notifications.py +++ b/occurrences/tests/snapshots/snap_test_notifications.py @@ -4,306 +4,307 @@ from snapshottest import Snapshot + snapshots = Snapshot() -snapshots["test_approve_enrolment_notification_email 1"] = [ - """no-reply@hel.ninja|['hutchinsonrachel@example.org']|Enrolment approved FI| +snapshots['test_approve_enrolment_notification_email 1'] = [ + '''no-reply@hel.ninja|['hutchinsonrachel@example.org']|Enrolment approved FI| Event FI: Raija Malka & Kaija Saariaho: Blick - Extra event info: qMPXL + Extra event info: MPXLz Study group: Skin watch media. Condition like lay still bar. From daughter order stay sign discover eight. - Occurrence: 13.04.1972 14.30 + Occurrence: 05.09.1971 14.16 Person: hutchinsonrachel@example.org Click this link to cancel the enrolment: https://kultus.hel.fi/fi/enrolments/cancel/mock-enrolment-unique-id-abc123xyz456 Custom message: custom message -""" +''' ] -snapshots["test_cancel_enrolment_notification_email 1"] = [ - """no-reply@hel.ninja|['gtorres@example.com']|Enrolment cancellation confirmation FI| +snapshots['test_cancel_enrolment_notification_email 1'] = [ + '''no-reply@hel.ninja|['brett47@example.com']|Enrolment cancellation confirmation FI| Event FI: Raija Malka & Kaija Saariaho: Blick - Extra event info: zVxeo - Study group: Tough plant traditional after born up always. Return student light a point charge. - Occurrence: 12.12.2013 06.37 - Person: gtorres@example.com + Extra event info: ytHjL + Study group: Campaign college career fight data. Generation man process white visit step. + Occurrence: 18.04.2002 11.13 + Person: brett47@example.com Custom message: custom message -""" +''' ] -snapshots["test_cancelled_enrolment_notification_email 1"] = [ - """no-reply@hel.ninja|['email_me@dommain.com']|Enrolment cancelled FI| +snapshots['test_cancelled_enrolment_notification_email 1'] = [ + '''no-reply@hel.ninja|['email_me@dommain.com']|Enrolment cancelled FI| Event FI: Raija Malka & Kaija Saariaho: Blick - Extra event info: zVxeo - Study group: Attorney six throughout shoulder decade. Message now case. - Occurrence: 12.12.2013 06.37 + Extra event info: ytHjL + Study group: Investment difference heart guess west black. + Occurrence: 18.04.2002 11.13 Person: email_me@dommain.com Custom message: custom message -""" +''' ] -snapshots["test_decline_enrolment_notification_email 1"] = [ - """no-reply@hel.ninja|['gtorres@example.com']|Enrolment declined FI| +snapshots['test_decline_enrolment_notification_email 1'] = [ + '''no-reply@hel.ninja|['brett47@example.com']|Enrolment declined FI| Event FI: Raija Malka & Kaija Saariaho: Blick - Extra event info: zVxeo - Study group: Tough plant traditional after born up always. Return student light a point charge. - Occurrence: 12.12.2013 06.37 - Person: gtorres@example.com + Extra event info: ytHjL + Study group: Campaign college career fight data. Generation man process white visit step. + Occurrence: 18.04.2002 11.13 + Person: brett47@example.com Custom message: custom message -""" +''' ] -snapshots["test_decline_enrolment_notification_email_to_multiple_contact_person 1"] = [ - """no-reply@hel.ninja|['gtorres@example.com']|Enrolment declined FI| +snapshots['test_decline_enrolment_notification_email_to_multiple_contact_person 1'] = [ + '''no-reply@hel.ninja|['brett47@example.com']|Enrolment declined FI| Event FI: Raija Malka & Kaija Saariaho: Blick - Extra event info: zVxeo - Study group: Tough plant traditional after born up always. Return student light a point charge. - Occurrence: 12.12.2013 06.37 - Person: gtorres@example.com + Extra event info: ytHjL + Study group: Campaign college career fight data. Generation man process white visit step. + Occurrence: 18.04.2002 11.13 + Person: brett47@example.com Custom message: custom message -""" +''' ] -snapshots["test_decline_enrolment_notification_email_to_multiple_contact_person 2"] = [ - """no-reply@hel.ninja|['gtorres@example.com']|Enrolment declined FI| +snapshots['test_decline_enrolment_notification_email_to_multiple_contact_person 2'] = [ + '''no-reply@hel.ninja|['brett47@example.com']|Enrolment declined FI| Event FI: Raija Malka & Kaija Saariaho: Blick - Extra event info: zVxeo - Study group: Tough plant traditional after born up always. Return student light a point charge. - Occurrence: 12.12.2013 06.37 - Person: gtorres@example.com + Extra event info: ytHjL + Study group: Campaign college career fight data. Generation man process white visit step. + Occurrence: 18.04.2002 11.13 + Person: brett47@example.com Custom message: custom message -""", - """no-reply@hel.ninja|['davidsummers@example.net']|Enrolment declined FI| +''', + '''no-reply@hel.ninja|['davidsummers@example.net']|Enrolment declined FI| Event FI: Raija Malka & Kaija Saariaho: Blick - Extra event info: HEUhR - Study group: Woman staff know eight account true tax. Tv news management letter. - Occurrence: 22.03.2014 02.11 + Extra event info: HHEUh + Study group: Close term where up notice environment father stay. Hold project month similar support line. + Occurrence: 01.11.2006 02.26 Person: davidsummers@example.net Custom message: custom message -""", - """no-reply@hel.ninja|['michaelanderson@example.net']|Enrolment declined FI| +''', + '''no-reply@hel.ninja|['sandra56@example.net']|Enrolment declined FI| Event FI: Raija Malka & Kaija Saariaho: Blick - Extra event info: HEUhR - Study group: Woman staff know eight account true tax. Tv news management letter. - Occurrence: 22.03.2014 02.11 - Person: michaelanderson@example.net + Extra event info: HHEUh + Study group: Close term where up notice environment father stay. Hold project month similar support line. + Occurrence: 01.11.2006 02.26 + Person: sandra56@example.net Custom message: custom message -""", +''' ] -snapshots["test_local_time_notification[tz0] 1"] = [ - """no-reply@hel.ninja|['hutchinsonrachel@example.org']|Occurrence enrolment FI| +snapshots['test_local_time_notification[tz0] 1'] = [ + '''no-reply@hel.ninja|['hutchinsonrachel@example.org']|Occurrence enrolment FI| Event FI: Raija Malka & Kaija Saariaho: Blick - Extra event info: gihpk + Extra event info: OhDGq Study group: Skin watch media. Condition like lay still bar. From daughter order stay sign discover eight. Occurrence: 04.01.2020 00.00 Person: hutchinsonrachel@example.org -""" +''' ] -snapshots["test_local_time_notification[tz1] 1"] = [ - """no-reply@hel.ninja|['hutchinsonrachel@example.org']|Occurrence enrolment FI| +snapshots['test_local_time_notification[tz1] 1'] = [ + '''no-reply@hel.ninja|['hutchinsonrachel@example.org']|Occurrence enrolment FI| Event FI: Raija Malka & Kaija Saariaho: Blick - Extra event info: gihpk + Extra event info: OhDGq Study group: Skin watch media. Condition like lay still bar. From daughter order stay sign discover eight. Occurrence: 04.01.2020 00.00 Person: hutchinsonrachel@example.org -""" +''' ] -snapshots["test_local_time_notification[tz2] 1"] = [ - """no-reply@hel.ninja|['hutchinsonrachel@example.org']|Occurrence enrolment FI| +snapshots['test_local_time_notification[tz2] 1'] = [ + '''no-reply@hel.ninja|['hutchinsonrachel@example.org']|Occurrence enrolment FI| Event FI: Raija Malka & Kaija Saariaho: Blick - Extra event info: gihpk + Extra event info: OhDGq Study group: Skin watch media. Condition like lay still bar. From daughter order stay sign discover eight. Occurrence: 04.01.2020 00.00 Person: hutchinsonrachel@example.org -""" +''' ] -snapshots["test_mass_approve_enrolment_mutation[False] 1"] = [ - """no-reply@hel.ninja|['brandonharvey@example.net']|Enrolment approved FI| +snapshots['test_mass_approve_enrolment_mutation[False] 1'] = [ + '''no-reply@hel.ninja|['jamesmcgrath@example.com']|Enrolment approved FI| Event FI: Raija Malka & Kaija Saariaho: Blick - Extra event info: bkihg - Study group: Work early property your stage receive. Determine sort under car. - Occurrence: 02.08.1988 10.00 - Person: brandonharvey@example.net + Extra event info: ZHkjd + Study group: Question national throw three. + Occurrence: 29.08.1983 12.55 + Person: jamesmcgrath@example.com Click this link to cancel the enrolment: https://kultus.hel.fi/fi/enrolments/cancel/mock-enrolment-unique-id-abc123xyz456 Custom message: Custom message -""", - """no-reply@hel.ninja|['operry@example.com']|Enrolment approved FI| +''', + '''no-reply@hel.ninja|['bradleybutler@example.com']|Enrolment approved FI| Event FI: Raija Malka & Kaija Saariaho: Blick - Extra event info: bkihg - Study group: Work early property your stage receive. Determine sort under car. - Occurrence: 02.08.1988 10.00 - Person: operry@example.com + Extra event info: ZHkjd + Study group: Question national throw three. + Occurrence: 29.08.1983 12.55 + Person: bradleybutler@example.com Click this link to cancel the enrolment: https://kultus.hel.fi/fi/enrolments/cancel/mock-enrolment-unique-id-abc123xyz456 Custom message: Custom message -""", - """no-reply@hel.ninja|['obrooks@example.net']|Enrolment approved FI| +''', + '''no-reply@hel.ninja|['schwartzkayla@example.org']|Enrolment approved FI| Event FI: Raija Malka & Kaija Saariaho: Blick - Extra event info: bkihg - Study group: Yes others enter program form you standard. - Occurrence: 02.08.1988 10.00 - Person: obrooks@example.net + Extra event info: ZHkjd + Study group: Better majority behavior along pressure yes others. Trouble change world indeed always. + Occurrence: 29.08.1983 12.55 + Person: schwartzkayla@example.org Click this link to cancel the enrolment: https://kultus.hel.fi/fi/enrolments/cancel/mock-enrolment-unique-id-abc123xyz456 Custom message: Custom message -""", - """no-reply@hel.ninja|['raymondking@example.org']|Enrolment approved FI| +''', + '''no-reply@hel.ninja|['cwall@example.net']|Enrolment approved FI| Event FI: Raija Malka & Kaija Saariaho: Blick - Extra event info: bkihg - Study group: Yes others enter program form you standard. - Occurrence: 02.08.1988 10.00 - Person: raymondking@example.org + Extra event info: ZHkjd + Study group: Better majority behavior along pressure yes others. Trouble change world indeed always. + Occurrence: 29.08.1983 12.55 + Person: cwall@example.net Click this link to cancel the enrolment: https://kultus.hel.fi/fi/enrolments/cancel/mock-enrolment-unique-id-abc123xyz456 Custom message: Custom message -""", - """no-reply@hel.ninja|['joelsandoval@example.com']|Enrolment approved FI| +''', + '''no-reply@hel.ninja|['elizabethschultz@example.net']|Enrolment approved FI| Event FI: Raija Malka & Kaija Saariaho: Blick - Extra event info: bkihg + Extra event info: ZHkjd Study group: Structure professional message road focus turn space. Art space along win. - Occurrence: 02.08.1988 10.00 - Person: joelsandoval@example.com + Occurrence: 29.08.1983 12.55 + Person: elizabethschultz@example.net Click this link to cancel the enrolment: https://kultus.hel.fi/fi/enrolments/cancel/mock-enrolment-unique-id-abc123xyz456 Custom message: Custom message -""", - """no-reply@hel.ninja|['madeline82@example.com']|Enrolment approved FI| +''', + '''no-reply@hel.ninja|['tammyjordan@example.com']|Enrolment approved FI| Event FI: Raija Malka & Kaija Saariaho: Blick - Extra event info: bkihg + Extra event info: ZHkjd Study group: Structure professional message road focus turn space. Art space along win. - Occurrence: 02.08.1988 10.00 - Person: madeline82@example.com + Occurrence: 29.08.1983 12.55 + Person: tammyjordan@example.com Click this link to cancel the enrolment: https://kultus.hel.fi/fi/enrolments/cancel/mock-enrolment-unique-id-abc123xyz456 Custom message: Custom message -""", +''' ] -snapshots["test_occurrence_enrolment_notifications_email_only 1"] = [ - """no-reply@hel.ninja|['gtorres@example.com']|Occurrence enrolment FI| +snapshots['test_occurrence_enrolment_notifications_email_only 1'] = [ + '''no-reply@hel.ninja|['brett47@example.com']|Occurrence enrolment FI| Event FI: Raija Malka & Kaija Saariaho: Blick - Extra event info: zVxeo - Study group: Tough plant traditional after born up always. Return student light a point charge. - Occurrence: 12.12.2013 06.37 - Person: gtorres@example.com -""", - """no-reply@hel.ninja|['gtorres@example.com']|Occurrence unenrolment FI| + Extra event info: ytHjL + Study group: Campaign college career fight data. Generation man process white visit step. + Occurrence: 18.04.2002 11.13 + Person: brett47@example.com +''', + '''no-reply@hel.ninja|['brett47@example.com']|Occurrence unenrolment FI| Event FI: Raija Malka & Kaija Saariaho: Blick - Extra event info: zVxeo - Study group: Tough plant traditional after born up always. Return student light a point charge. - Occurrence: 12.12.2013 06.57 - Person: gtorres@example.com -""", - """no-reply@hel.ninja|['gtorres@example.com']|Occurrence enrolment EN| + Extra event info: ytHjL + Study group: Campaign college career fight data. Generation man process white visit step. + Occurrence: 18.04.2002 11.13 + Person: brett47@example.com +''', + '''no-reply@hel.ninja|['brett47@example.com']|Occurrence enrolment EN| Event EN: Raija Malka & Kaija Saariaho: Blick - Extra event info: zVxeo - Study group: Woman staff know eight account true tax. Tv news management letter. - Occurrence: 12.12.2013 06.37 - Person: michaelanderson@example.net""", - """no-reply@hel.ninja|['gtorres@example.com']|Occurrence unenrolment EN| + Extra event info: ytHjL + Study group: Close term where up notice environment father stay. Hold project month similar support line. + Occurrence: 18.04.2002 11.13 + Person: sandra56@example.net''', + '''no-reply@hel.ninja|['brett47@example.com']|Occurrence unenrolment EN| Event EN: Raija Malka & Kaija Saariaho: Blick - Extra event info: zVxeo - Study group: Woman staff know eight account true tax. Tv news management letter. - Occurrence: 12.12.2013 06.57 - Person: michaelanderson@example.net""", + Extra event info: ytHjL + Study group: Close term where up notice environment father stay. Hold project month similar support line. + Occurrence: 18.04.2002 11.13 + Person: sandra56@example.net''' ] -snapshots["test_occurrence_enrolment_notifications_to_contact_person 1"] = [ - """no-reply@hel.ninja|['email_me@dommain.com']|Occurrence enrolment FI| +snapshots['test_occurrence_enrolment_notifications_to_contact_person 1'] = [ + '''no-reply@hel.ninja|['email_me@dommain.com']|Occurrence enrolment FI| Event FI: Raija Malka & Kaija Saariaho: Blick - Extra event info: zVxeo - Study group: Tough plant traditional after born up always. Return student light a point charge. - Occurrence: 12.12.2013 06.37 + Extra event info: ytHjL + Study group: Campaign college career fight data. Generation man process white visit step. + Occurrence: 18.04.2002 11.13 Person: email_me@dommain.com -""", - """no-reply@hel.ninja|['email_me@dommain.com']|Occurrence unenrolment FI| +''', + '''no-reply@hel.ninja|['email_me@dommain.com']|Occurrence unenrolment FI| Event FI: Raija Malka & Kaija Saariaho: Blick - Extra event info: zVxeo - Study group: Tough plant traditional after born up always. Return student light a point charge. - Occurrence: 12.12.2013 06.57 + Extra event info: ytHjL + Study group: Campaign college career fight data. Generation man process white visit step. + Occurrence: 18.04.2002 11.13 Person: email_me@dommain.com -""", - """no-reply@hel.ninja|['email_me@dommain.com']|Occurrence enrolment EN| +''', + '''no-reply@hel.ninja|['email_me@dommain.com']|Occurrence enrolment EN| Event EN: Raija Malka & Kaija Saariaho: Blick - Extra event info: zVxeo - Study group: Watch method political institution trip race kitchen. Send same even child. - Occurrence: 12.12.2013 06.37 - Person: do_not_email_me@domain.com""", - """no-reply@hel.ninja|['email_me@dommain.com']|Occurrence unenrolment EN| + Extra event info: ytHjL + Study group: Race kitchen change single now rich. Bill write color politics. Matter this same happy standard. + Occurrence: 18.04.2002 11.13 + Person: do_not_email_me@domain.com''', + '''no-reply@hel.ninja|['email_me@dommain.com']|Occurrence unenrolment EN| Event EN: Raija Malka & Kaija Saariaho: Blick - Extra event info: zVxeo - Study group: Watch method political institution trip race kitchen. Send same even child. - Occurrence: 12.12.2013 06.57 - Person: do_not_email_me@domain.com""", + Extra event info: ytHjL + Study group: Race kitchen change single now rich. Bill write color politics. Matter this same happy standard. + Occurrence: 18.04.2002 11.13 + Person: do_not_email_me@domain.com''' ] -snapshots["test_only_send_approved_notification[False] 1"] = [ - """no-reply@hel.ninja|['hutchinsonrachel@example.org']|Occurrence enrolment FI| +snapshots['test_only_send_approved_notification[False] 1'] = [ + '''no-reply@hel.ninja|['hutchinsonrachel@example.org']|Occurrence enrolment FI| Event FI: Raija Malka & Kaija Saariaho: Blick - Extra event info: qMPXL + Extra event info: MPXLz Study group: Skin watch media. Condition like lay still bar. From daughter order stay sign discover eight. - Occurrence: 13.04.1972 14.30 + Occurrence: 05.09.1971 14.16 Person: hutchinsonrachel@example.org -""", - """no-reply@hel.ninja|['hutchinsonrachel@example.org']|Enrolment approved FI| +''', + '''no-reply@hel.ninja|['hutchinsonrachel@example.org']|Enrolment approved FI| Event FI: Raija Malka & Kaija Saariaho: Blick - Extra event info: qMPXL + Extra event info: MPXLz Study group: Skin watch media. Condition like lay still bar. From daughter order stay sign discover eight. - Occurrence: 13.04.1972 14.30 + Occurrence: 05.09.1971 14.16 Person: hutchinsonrachel@example.org -""", +''' ] -snapshots["test_only_send_approved_notification[True] 1"] = [ - """no-reply@hel.ninja|['hutchinsonrachel@example.org']|Enrolment approved FI| +snapshots['test_only_send_approved_notification[True] 1'] = [ + '''no-reply@hel.ninja|['hutchinsonrachel@example.org']|Enrolment approved FI| Event FI: Raija Malka & Kaija Saariaho: Blick - Extra event info: qMPXL + Extra event info: MPXLz Study group: Skin watch media. Condition like lay still bar. From daughter order stay sign discover eight. - Occurrence: 13.04.1972 14.30 + Occurrence: 05.09.1971 14.16 Person: hutchinsonrachel@example.org -""" +''' ] -snapshots["test_send_enrolment_summary_report 1"] = [ - """no-reply@hel.ninja|['halljames@example.org']|Enrolment approved FI| +snapshots['test_send_enrolment_summary_report 1'] = [ + '''no-reply@hel.ninja|['john29@example.com']|Enrolment approved FI| Total pending enrolments: 3 Total new accepted enrolments: 1 Event name: Raija Malka & Kaija Saariaho: Blick - Event link: https://kultus-admin.hel.fi/fi/events/XalDf - Occurrence: #2020-01-13 22:00:00+00:00 (1 pending) - Link to occurrence: https://kultus-admin.hel.fi/fi/events/XalDf/occurrences/T2NjdXJyZW5jZU5vZGU6MzE= - Event name: Raija Malka & Kaija Saariaho: Blick Event link: https://kultus-admin.hel.fi/fi/events/TuZpF Occurrence: #2020-01-13 22:00:00+00:00 (1 new enrolments) Link to occurrence: https://kultus-admin.hel.fi/fi/events/TuZpF/occurrences/T2NjdXJyZW5jZU5vZGU6NDE= Event name: Raija Malka & Kaija Saariaho: Blick - Event link: https://kultus-admin.hel.fi/fi/events/VnRGu + Event link: https://kultus-admin.hel.fi/fi/events/csgfn + Occurrence: #2020-01-13 22:00:00+00:00 (1 pending) + Link to occurrence: https://kultus-admin.hel.fi/fi/events/csgfn/occurrences/T2NjdXJyZW5jZU5vZGU6MzE= + Event name: Raija Malka & Kaija Saariaho: Blick + Event link: https://kultus-admin.hel.fi/fi/events/jfwob Occurrence: #2020-01-13 22:00:00+00:00 (1 pending) - Link to occurrence: https://kultus-admin.hel.fi/fi/events/VnRGu/occurrences/T2NjdXJyZW5jZU5vZGU6MjE= + Link to occurrence: https://kultus-admin.hel.fi/fi/events/jfwob/occurrences/T2NjdXJyZW5jZU5vZGU6MjE= Occurrence: #2020-01-13 22:00:00+00:00 (1 pending) - Link to occurrence: https://kultus-admin.hel.fi/fi/events/VnRGu/occurrences/T2NjdXJyZW5jZU5vZGU6MjI= - """, - """no-reply@hel.ninja|['dsellers@example.net']|Enrolment approved FI| + Link to occurrence: https://kultus-admin.hel.fi/fi/events/jfwob/occurrences/T2NjdXJyZW5jZU5vZGU6MjI= + ''', + '''no-reply@hel.ninja|['dsellers@example.net']|Enrolment approved FI| Total pending enrolments: 4 Total new accepted enrolments: 0 Event name: Raija Malka & Kaija Saariaho: Blick @@ -312,5 +313,5 @@ Link to occurrence: https://kultus-admin.hel.fi/fi/events/aAVEa/occurrences/T2NjdXJyZW5jZU5vZGU6MTE= Occurrence: #2020-01-13 22:00:00+00:00 (1 pending) Link to occurrence: https://kultus-admin.hel.fi/fi/events/aAVEa/occurrences/T2NjdXJyZW5jZU5vZGU6MTI= - """, + ''' ] diff --git a/occurrences/tests/test_api.py b/occurrences/tests/test_api.py index 3106e196..abe047af 100644 --- a/occurrences/tests/test_api.py +++ b/occurrences/tests/test_api.py @@ -1,10 +1,11 @@ -import pytest from copy import deepcopy from datetime import datetime, timedelta +from unittest.mock import patch + +import pytest from django.core import mail from django.utils import timezone from graphql_relay import to_global_id -from unittest.mock import patch from common.tests.utils import ( assert_mails_match_snapshot, @@ -91,7 +92,7 @@ def autouse_db(db): pass -def test_languagess_query(snapshot, language, api_client): +def test_languages_query(snapshot, language, api_client): executed = api_client.execute(LANGUAGES_QUERY) snapshot.assert_match(executed) @@ -1538,6 +1539,7 @@ def test_approve_enrolment( snapshot, staff_api_client, mock_get_event_data, + mock_enrolment_unique_id, notification_template_enrolment_approved_en, notification_template_enrolment_approved_fi, ): @@ -1587,6 +1589,7 @@ def test_approve_enrolment_with_custom_message( snapshot, staff_api_client, mock_get_event_data, + mock_enrolment_unique_id, notification_template_enrolment_approved_en, notification_template_enrolment_approved_fi, ): @@ -2334,10 +2337,7 @@ def test_occurrence_study_groups_unauthorized( OCCURRENCE_STUDY_GROUPS_QUERY, variables={"id": to_global_id("OccurrenceNode", occurrence.id)}, ) - # FIXME: The permission denied error should be raised - # assert_permission_denied(executed) - # assert executed["data"]["occurrence"]["studyGroups"]["edges"] == [] - assert executed["data"]["occurrence"] is None + assert executed["data"]["occurrence"]["studyGroups"]["edges"] == [] # Valid case: The organisation matches staff_api_client.user.person.organisations.add(occurrence.p_event.organisation) diff --git a/occurrences/tests/test_commands.py b/occurrences/tests/test_commands.py index 45d6af01..1d018619 100644 --- a/occurrences/tests/test_commands.py +++ b/occurrences/tests/test_commands.py @@ -1,4 +1,6 @@ import json +from io import StringIO + import pytest import responses from dateutil.relativedelta import relativedelta @@ -6,7 +8,6 @@ from django.test import override_settings from django.utils import timezone from django.utils.timezone import localtime -from io import StringIO from occurrences.consts import ( NOTIFICATION_TYPE_ALL, diff --git a/occurrences/tests/test_event_api_services.py b/occurrences/tests/test_event_api_services.py index 63e3cb4f..b9c8c905 100644 --- a/occurrences/tests/test_event_api_services.py +++ b/occurrences/tests/test_event_api_services.py @@ -1,8 +1,9 @@ -import pytest from datetime import timedelta -from django.utils import timezone from unittest.mock import patch +import pytest +from django.utils import timezone + from common.tests.utils import mocked_json_response from common.utils import format_linked_event_datetime from occurrences.event_api_services import api_client as le_api_client diff --git a/occurrences/tests/test_models.py b/occurrences/tests/test_models.py index 747fe161..732c1b7a 100644 --- a/occurrences/tests/test_models.py +++ b/occurrences/tests/test_models.py @@ -1,10 +1,11 @@ -import pytest from datetime import datetime, timedelta +from unittest.mock import patch + +import pytest from django.contrib.auth import get_user_model from django.core.exceptions import ValidationError from django.utils import timezone from freezegun import freeze_time -from unittest.mock import patch from graphene_linked_events.tests.mock_data import EVENT_DATA from occurrences.consts import StudyGroupStudyLevels @@ -192,9 +193,12 @@ def test_study_group_with_organisation_ids(mock_get_place_data, mock_get_event_d group_without_enrolment = StudyGroupFactory() # Without enrolment, so without organisation - StudyGroup.objects.with_organisation_ids().get( - id=group_without_enrolment.id - ).organisation_ids is None + assert ( + StudyGroup.objects.with_organisation_ids() + .get(id=group_without_enrolment.id) + .organisation_ids + == [] + ) # With multiple enrolments to multiple organisations group_with_multiple_organisations = StudyGroupFactory() diff --git a/occurrences/tests/test_notifications.py b/occurrences/tests/test_notifications.py index d17038a1..6bc1f8d5 100644 --- a/occurrences/tests/test_notifications.py +++ b/occurrences/tests/test_notifications.py @@ -1,10 +1,11 @@ +from datetime import datetime, timedelta +from unittest.mock import patch + import pytest import pytz -from datetime import datetime, timedelta from django.core import mail from django.utils import timezone from graphql_relay import to_global_id -from unittest.mock import patch from common.tests.utils import assert_mails_match_snapshot from occurrences.consts import NOTIFICATION_TYPE_ALL, NOTIFICATION_TYPE_SMS diff --git a/occurrences/tests/test_signals.py b/occurrences/tests/test_signals.py index 8fd92959..6faf7d3a 100644 --- a/occurrences/tests/test_signals.py +++ b/occurrences/tests/test_signals.py @@ -1,6 +1,7 @@ -import pytest from unittest.mock import patch +import pytest + from common.tests.utils import mocked_json_response from graphene_linked_events.utils import api_client from occurrences.factories import LanguageFactory, OccurrenceFactory diff --git a/organisations/admin.py b/organisations/admin.py index fa9e208a..b3b9e2a1 100644 --- a/organisations/admin.py +++ b/organisations/admin.py @@ -1,3 +1,5 @@ +from typing import Any + from django import forms from django.conf import settings from django.contrib import admin, messages @@ -10,7 +12,6 @@ from django.urls import reverse from django.utils.translation import gettext as _ from django_admin_listfilter_dropdown.filters import RelatedDropdownFilter -from typing import Any from occurrences.models import StudyGroup from organisations.models import Organisation, OrganisationProposal, Person, User @@ -67,9 +68,7 @@ def __init__(self, *args, **kwargs): self.fields["applicant"].queryset = Person.objects.all().order_by( "name", "-created_at" ) - self.fields[ - "applicant" - ].label_from_instance = ( + self.fields["applicant"].label_from_instance = ( lambda instance: f"{instance.__str__()} (id: {instance.id})" ) diff --git a/organisations/factories.py b/organisations/factories.py index d499c11e..04197ffb 100644 --- a/organisations/factories.py +++ b/organisations/factories.py @@ -1,6 +1,7 @@ import factory from django.contrib.auth import get_user_model +from common.mixins import SaveAfterPostGenerationMixin from organisations.models import Organisation, OrganisationProposal, Person @@ -22,9 +23,10 @@ class UserFactory(factory.django.DjangoModelFactory): class Meta: model = get_user_model() exclude = ("username_base", "username_suffix") + skip_postgeneration_save = True # Not needed after factory v4.0.0 -class PersonFactory(factory.django.DjangoModelFactory): +class PersonFactory(SaveAfterPostGenerationMixin, factory.django.DjangoModelFactory): user = factory.SubFactory(UserFactory) name = factory.Faker("name") phone_number = factory.Faker("phone_number") @@ -57,6 +59,7 @@ class OrganisationFactory(factory.django.DjangoModelFactory): class Meta: model = Organisation + skip_postgeneration_save = True # Not needed after factory v4.0.0 class OrganisationProposalFactory(factory.django.DjangoModelFactory): @@ -67,3 +70,4 @@ class OrganisationProposalFactory(factory.django.DjangoModelFactory): class Meta: model = OrganisationProposal + skip_postgeneration_save = True # Not needed after factory v4.0.0 diff --git a/organisations/schema.py b/organisations/schema.py index dc425ebb..6c7f049e 100644 --- a/organisations/schema.py +++ b/organisations/schema.py @@ -9,7 +9,12 @@ from graphene_django.types import DjangoObjectType from graphql_jwt.decorators import login_required, superuser_required -from common.utils import get_node_id_from_global_id, LanguageEnum, update_object +from common.utils import ( + get_node_id_from_global_id, + LanguageEnum, + map_enums_to_values_in_kwargs, + update_object, +) from organisations.models import Organisation, OrganisationProposal, Person from palvelutarjotin.exceptions import ( ApiUsageError, @@ -32,6 +37,9 @@ class Meta: @classmethod def get_queryset(cls, queryset, info): + # Allow access to person related to added study group in AddStudyGroupMutation + if info.path.as_list() == ["addStudyGroup", "studyGroup", "person"]: + return queryset return queryset.user_can_view(info.context.user).order_by("name") def resolve_is_staff(self, info, **kwargs): @@ -100,6 +108,7 @@ class Input: @classmethod @login_required @transaction.atomic + @map_enums_to_values_in_kwargs def mutate_and_get_payload(cls, root, info, **kwargs): user = info.context.user if Person.objects.filter(user=user).exists(): @@ -145,6 +154,7 @@ class Input: @classmethod @login_required @transaction.atomic + @map_enums_to_values_in_kwargs def mutate_and_get_payload(cls, root, info, **kwargs): validate_person_data(kwargs) user = info.context.user @@ -196,6 +206,7 @@ class Input: @classmethod @superuser_required @transaction.atomic + @map_enums_to_values_in_kwargs def mutate_and_get_payload(cls, root, info, **kwargs): validate_organisation_data(**kwargs) organisation = Organisation.objects.create(**kwargs) @@ -215,6 +226,7 @@ class Input: @classmethod @superuser_required @transaction.atomic + @map_enums_to_values_in_kwargs def mutate_and_get_payload(cls, root, info, **kwargs): organisation_id = get_node_id_from_global_id( kwargs.pop("id"), "OrganisationNode" @@ -244,6 +256,7 @@ class Input: @classmethod @superuser_required @transaction.atomic + @map_enums_to_values_in_kwargs def mutate_and_get_payload(cls, root, info, **kwargs): person_id = get_node_id_from_global_id(kwargs.pop("id"), "PersonNode") try: diff --git a/organisations/services.py b/organisations/services.py index 44df2404..bb19602e 100644 --- a/organisations/services.py +++ b/organisations/services.py @@ -1,11 +1,12 @@ from __future__ import annotations import logging +from typing import TYPE_CHECKING + from django.conf import settings from django.contrib.auth import get_user_model from django.urls import reverse from django_ilmoitin.utils import send_notification -from typing import TYPE_CHECKING from organisations.consts import NotificationTemplate diff --git a/organisations/tests/snapshots/snap_test_api.py b/organisations/tests/snapshots/snap_test_api.py index 77b8f6d0..e0161d17 100644 --- a/organisations/tests/snapshots/snap_test_api.py +++ b/organisations/tests/snapshots/snap_test_api.py @@ -69,7 +69,7 @@ "language": "FI", "name": "Amanda Newton", "organisations": {"edges": [{"node": {"name": "Smith, Wood and Baker"}}]}, - "phoneNumber": "976-380-3466x9727", + "phoneNumber": "497-963-8034x6697", "placeIds": ["VXgFfhhcjebLxIzCCeza", "knnouKQItjsGbbnCZaIe"], } } @@ -78,13 +78,13 @@ snapshots["test_my_profile_query 2"] = { "data": { "myProfile": { - "emailAddress": "natalie62@example.com", + "emailAddress": "jmoore@example.org", "isStaff": True, "language": "FI", "name": "Cheyenne Carson", "organisations": {"edges": [{"node": {"name": "Smith, Wood and Baker"}}]}, - "phoneNumber": "001-959-911-8326x3986", - "placeIds": ["lLyOWeWgxNvIdaNadghC", "GVbfWcQLRyaHhQRmINWY"], + "phoneNumber": "001-895-799-1183x2639", + "placeIds": ["yOWeWgxNvIdaNadghCet", "YgCAuXtmqVxzDraSqNld"], } } } @@ -94,7 +94,7 @@ "organisation": { "name": "Graves and Sons", "persons": {"edges": []}, - "phoneNumber": "+1-906-333-4577", + "phoneNumber": "+1-990-963-3345", "publisherId": "rtOzV", "type": "USER", } @@ -109,7 +109,7 @@ "node": { "name": "Graves and Sons", "persons": {"edges": []}, - "phoneNumber": "+1-906-333-4577", + "phoneNumber": "+1-990-963-3345", "publisherId": "rtOzV", "type": "USER", } @@ -127,7 +127,7 @@ "node": { "name": "Graves and Sons", "persons": {"edges": []}, - "phoneNumber": "+1-906-333-4577", + "phoneNumber": "+1-990-963-3345", "publisherId": "VrtOz", "type": "PROVIDER", } @@ -136,8 +136,8 @@ "node": { "name": "Bryant-Davis", "persons": {"edges": []}, - "phoneNumber": "067-506-4976x380", - "publisherId": "muDyx", + "phoneNumber": "206-575-0649x763", + "publisherId": "nvThb", "type": "PROVIDER", } }, @@ -145,7 +145,7 @@ "node": { "name": "Garcia Group", "persons": {"edges": []}, - "phoneNumber": "+1-159-102-3202x8130", + "phoneNumber": "+1-515-291-0232x0281", "publisherId": "yiWRb", "type": "PROVIDER", } @@ -163,17 +163,17 @@ "node": { "name": "Hawkins, Davis and Porter", "persons": {"edges": []}, - "phoneNumber": "1234474468", - "publisherId": "KQItj", + "phoneNumber": "8127344744", + "publisherId": "QItjs", "type": "USER", } }, { "node": { - "name": "Mack-Travis", + "name": "Travis, Thomas and Ochoa", "persons": {"edges": []}, - "phoneNumber": "(048)830-1905", - "publisherId": "XAmjO", + "phoneNumber": "+1-583-401-9054", + "publisherId": "jOnQt", "type": "USER", } }, @@ -190,14 +190,14 @@ { "node": { "studyGroup": { - "groupName": "Work early property your stage receive. Determine sort under car." + "groupName": "Hand human value base pattern democratic focus. Kind various laugh smile behavior." } } }, { "node": { "studyGroup": { - "groupName": "Ask alone them yeah none young area. Guy Democrat throw score watch method political." + "groupName": "Close term where up notice environment father stay. Hold project month similar support line." } } }, @@ -219,7 +219,7 @@ { "node": { "studyGroup": { - "groupName": "Tend practice other poor. Carry owner sense other can loss get girl." + "groupName": "Civil find learn follow. Tend practice other poor." } } }, @@ -237,12 +237,12 @@ snapshots["test_person_query 3"] = { "data": { "person": { - "emailAddress": "imonroe@example.org", + "emailAddress": "jacobbrown@example.net", "language": "FI", - "name": "Natalie Keith", + "name": "Brian Daniels", "organisations": {"edges": []}, - "phoneNumber": "+1-042-405-4852", - "placeIds": ["FDdlvJGuUZtSihlLyOWe", "iaGbqMPXLzvLVGVbfWcQ"], + "phoneNumber": "440.584.7694x703", + "placeIds": ["nddsAMQQNGTIkhlhOSlf", "VcHUQIIHoLALPuMgdVNr"], } } } @@ -250,12 +250,12 @@ snapshots["test_person_query 4"] = { "data": { "person": { - "emailAddress": "andrewgreen@example.net", + "emailAddress": "ochoaangela@example.org", "language": "FI", "name": "Carolyn Scott", "organisations": {"edges": [{"node": {"name": "Williams-Newton"}}]}, - "phoneNumber": "446.858.1662x4590", - "placeIds": ["RVJDOXAmjOnQtrkEQOln", "VMNZoGFTsuALvDSCvIVy"], + "phoneNumber": "244.468.5816x6245", + "placeIds": ["JDOXAmjOnQtrkEQOlnVO",], } } } @@ -268,14 +268,14 @@ { "node": { "studyGroup": { - "groupName": "Second yet pay. First teach democratic." + "groupName": "Let join might player example environment. Then offer organization model." } } }, { "node": { "studyGroup": { - "groupName": "Reach ask I cut ok. Perhaps teacher involve all my improve our Congress." + "groupName": "By rate activity business let art. Admit think edge once election seat." } } }, @@ -289,11 +289,11 @@ { "node": { "studyGroup": { - "groupName": "By rate activity business let art. Admit think edge once election seat." + "groupName": "Reach ask I cut ok. Perhaps teacher involve all my improve our Congress." } } }, - {"node": {"studyGroup": {"groupName": "Six feel real fast."}}}, + {"node": {"studyGroup": {"groupName": "Second yet pay. First teach democratic."}}}, ] }, "name": "Patrick Estrada", @@ -309,12 +309,12 @@ "edges": [ { "node": { - "groupName": "Work early property your stage receive. Determine sort under car." + "groupName": "Hand human value base pattern democratic focus. Kind various laugh smile behavior." } }, { "node": { - "groupName": "Ask alone them yeah none young area. Guy Democrat throw score watch method political." + "groupName": "Close term where up notice environment father stay. Hold project month similar support line." } }, { @@ -330,7 +330,7 @@ }, { "node": { - "groupName": "Tend practice other poor. Carry owner sense other can loss get girl." + "groupName": "Civil find learn follow. Tend practice other poor." } }, ] @@ -349,11 +349,11 @@ "edges": [ { "node": { - "emailAddress": "imonroe@example.org", + "emailAddress": "jacobbrown@example.net", "language": "FI", - "name": "Natalie Keith", + "name": "Brian Daniels", "organisations": {"edges": []}, - "phoneNumber": "+1-042-405-4852", + "phoneNumber": "440.584.7694x703", } } ] @@ -367,31 +367,41 @@ "edges": [ { "node": { - "emailAddress": "andrewgreen@example.net", + "emailAddress": "michael41@example.net", "language": "FI", - "name": "Carolyn Scott", + "name": "Brett Dean", "organisations": { - "edges": [{"node": {"name": "Williams-Newton"}}] + "edges": [], }, - "phoneNumber": "446.858.1662x4590", + "phoneNumber": "+1-362-312-6661x44948", } }, { "node": { - "emailAddress": "kwebster@example.net", + "emailAddress": "jacobbrown@example.net", "language": "FI", - "name": "Jessica Baker", - "organisations": {"edges": []}, - "phoneNumber": "001-659-825-0580", + "name": "Brian Daniels", + "organisations": { + "edges": [], + }, + "phoneNumber": "440.584.7694x703", } }, { "node": { - "emailAddress": "imonroe@example.org", + "emailAddress": "ochoaangela@example.org", "language": "FI", - "name": "Natalie Keith", - "organisations": {"edges": []}, - "phoneNumber": "+1-042-405-4852", + "name": "Carolyn Scott", + "organisations": { + "edges": [ + { + "node": { + "name": "Williams-Newton", + }, + }, + ], + }, + "phoneNumber": "244.468.5816x6245", } }, ] @@ -408,7 +418,7 @@ "language": "SV", "name": "New name", "organisations": {"edges": []}, - "phoneNumber": "976-380-3466x9727", + "phoneNumber": "497-963-8034x6697", "placeIds": ["xyz:123", "xxx:123"], } } @@ -420,7 +430,7 @@ "updateOrganisation": { "organisation": { "name": "New name", - "phoneNumber": "976-380-3466x9727", + "phoneNumber": "497-963-8034x6697", "publisherId": "publisher_id", "type": "USER", } @@ -436,7 +446,7 @@ "language": "SV", "name": "New name", "organisations": {"edges": [{"node": {"name": "Williams-Newton"}}]}, - "phoneNumber": "446.858.1662x4590", + "phoneNumber": "244.468.5816x6245", } } } diff --git a/organisations/tests/snapshots/snap_test_notifications.py b/organisations/tests/snapshots/snap_test_notifications.py index fc4506bb..aacfb188 100644 --- a/organisations/tests/snapshots/snap_test_notifications.py +++ b/organisations/tests/snapshots/snap_test_notifications.py @@ -7,7 +7,7 @@ snapshots = Snapshot() snapshots["test_myprofile_accepted_email[en] 1"] = [ - """no-reply@hel.ninja|['jamesgregory@example.com']|My profile accepted EN| + """no-reply@hel.ninja|['sreyes@example.com']|My profile accepted EN|

Hi Kyle Walls!

Your account is now ready to be used in Kultus with the following organisations linked to your account:

@@ -21,7 +21,7 @@ ] snapshots["test_myprofile_accepted_email[fi] 1"] = [ - """no-reply@hel.ninja|['jamesgregory@example.com']|My profile accepted FI| + """no-reply@hel.ninja|['sreyes@example.com']|My profile accepted FI|

Hei Kyle Walls!

Sinun käyttäjäsi on nyt valmis käytettäväksi Kultuksessa seuraavilla organisaatioille:

@@ -35,7 +35,7 @@ ] snapshots["test_myprofile_creation_email 1"] = [ - """no-reply@hel.ninja|['juliakeith@example.net']|My profile creation FI| + """no-reply@hel.ninja|['jennifer62@example.org']|My profile creation FI|

Hyvä Kultus ylläpitäjä!

Uusi palveluntarjoajan tunnus on luotu!

@@ -54,8 +54,8 @@

Käyttäjä haluaisi edustaa seuraavia organisaatioita:

    -
  • Jackson, Wolfe and Rogers
  • Smith, Wood and Baker
  • +
  • Wolfe, Rogers and Morgan

Muokataksesi luotua käyttäjätunnusta, klikkaa tästä!

@@ -64,7 +64,7 @@

Erityisviesti: custom message

""", - """no-reply@hel.ninja|['holmesleslie@example.com']|My profile creation FI| + """no-reply@hel.ninja|['lsimmons@example.com']|My profile creation FI|

Hyvä Kultus ylläpitäjä!

Uusi palveluntarjoajan tunnus on luotu!

@@ -83,8 +83,8 @@

Käyttäjä haluaisi edustaa seuraavia organisaatioita:

    -
  • Jackson, Wolfe and Rogers
  • Smith, Wood and Baker
  • +
  • Wolfe, Rogers and Morgan

Muokataksesi luotua käyttäjätunnusta, klikkaa tästä!

@@ -93,7 +93,7 @@

Erityisviesti: custom message

""", - """no-reply@hel.ninja|['perezlisa@example.net']|My profile creation EN| + """no-reply@hel.ninja|['patrickkenneth@example.com']|My profile creation EN|

Dear Kultus Admin!

A new Kultus provider user profile is created!

@@ -112,8 +112,8 @@

The user would like to represent these organisations:

    -
  • Jackson, Wolfe and Rogers
  • Smith, Wood and Baker
  • +
  • Wolfe, Rogers and Morgan

To edit the newly created user profile, click here!

diff --git a/organisations/tests/test_admin.py b/organisations/tests/test_admin.py index cd7ff350..90446cfe 100644 --- a/organisations/tests/test_admin.py +++ b/organisations/tests/test_admin.py @@ -1,9 +1,10 @@ +from unittest import mock + import pytest from django.contrib.admin.sites import AdminSite from django.contrib.auth import get_user_model from django.core import mail from django.test import TestCase -from unittest import mock from organisations.admin import PersonAdmin, PersonAdminForm, UserAdmin, UserAdminForm from organisations.factories import ( diff --git a/organisations/tests/test_api.py b/organisations/tests/test_api.py index c7f3ebf4..8130e72b 100644 --- a/organisations/tests/test_api.py +++ b/organisations/tests/test_api.py @@ -1,5 +1,6 @@ -import pytest from copy import deepcopy + +import pytest from django.core import mail from graphql_relay import to_global_id @@ -65,7 +66,7 @@ def autouse_db(db): """ ORGANISATIONS_QUERY = """ -query Organisations($type : String){ +query Organisations($type : OrganisationsOrganisationTypeChoices){ organisations(type:$type) { edges{ node{ @@ -342,9 +343,16 @@ def test_organisations_query_large_max_limit(staff_api_client, organisation): def test_organisations_query_type_filter(snapshot, api_client): OrganisationFactory.create_batch(3, type=Organisation.TYPE_PROVIDER) OrganisationFactory.create_batch(2, type=Organisation.TYPE_USER) - executed = api_client.execute(ORGANISATIONS_QUERY, variables={"type": "provider"}) + # Graphene converts choices to uppercase + # https://github.com/graphql-python/graphene-django/issues/280 + # so that's why we need to convert them to uppercase here: + executed = api_client.execute( + ORGANISATIONS_QUERY, variables={"type": Organisation.TYPE_PROVIDER.upper()} + ) snapshot.assert_match(executed) - executed = api_client.execute(ORGANISATIONS_QUERY, variables={"type": "user"}) + executed = api_client.execute( + ORGANISATIONS_QUERY, variables={"type": Organisation.TYPE_USER.upper()} + ) snapshot.assert_match(executed) @@ -515,7 +523,7 @@ def test_add_organisation_without_publisher_id(superuser_api_client): assert executed.get("errors") assert executed["errors"][0]["extensions"]["code"] == "GENERAL_ERROR" assert ( - 'In field "publisherId": Expected "String!", found null' + "Field 'publisherId' of required type 'String!' was not provided." in executed["errors"][0]["message"] ) @@ -529,9 +537,9 @@ def test_add_organisation_with_null_publisher_id(superuser_api_client): assert executed.get("errors") assert executed["errors"][0]["extensions"]["code"] == "GENERAL_ERROR" assert ( - 'In field "publisherId": Expected "String!", found null' - in executed["errors"][0]["message"] - ) + "Variable '$input' got invalid value None at 'input.publisherId'; " + + "Expected non-nullable type 'String!' not to be None." + ) in executed["errors"][0]["message"] @pytest.mark.parametrize("publisher_id", ["", " ", " " * 10]) @@ -793,7 +801,7 @@ def test_person_study_groups_unauthorized( PERSON_STUDY_GROUPS_QUERY, variables={"id": to_global_id("PersonNode", person.id)}, ) - assert executed["data"]["person"] is None + assert executed["data"]["person"]["studygroupSet"]["edges"] == [] # with staff API with other organisation staff_api_client.user.person.organisations.add(organisation) diff --git a/palvelutarjotin/schema.py b/palvelutarjotin/schema.py index 7368676f..59f838e4 100644 --- a/palvelutarjotin/schema.py +++ b/palvelutarjotin/schema.py @@ -11,7 +11,7 @@ import occurrences.schema import organisations.schema import servicemap.schema -from common.utils import LanguageEnum +from common.utils import LanguageEnum, map_enums_to_values_in_kwargs from palvelutarjotin.exceptions import ApiUsageError @@ -55,6 +55,7 @@ class Query( ) @staticmethod + @map_enums_to_values_in_kwargs def resolve_notification_template(parent, info, **kwargs): try: template = NotificationTemplate.objects.get(type=kwargs["template_type"]) diff --git a/palvelutarjotin/settings.py b/palvelutarjotin/settings.py index cb766550..c06ceea0 100644 --- a/palvelutarjotin/settings.py +++ b/palvelutarjotin/settings.py @@ -1,8 +1,9 @@ -import environ import os -import sentry_sdk import subprocess from datetime import datetime + +import environ +import sentry_sdk from django.utils.translation import gettext_lazy as _ from sentry_sdk.integrations.django import DjangoIntegration @@ -308,6 +309,7 @@ GRAPHENE = { "SCHEMA": "palvelutarjotin.schema.schema", "MIDDLEWARE": ["graphql_jwt.middleware.JSONWebTokenMiddleware"], + "DJANGO_CHOICE_FIELD_ENUM_CONVERT": True, } GRAPHQL_JWT = {"JWT_AUTH_HEADER_PREFIX": "Bearer"} diff --git a/palvelutarjotin/tests/test_oidc.py b/palvelutarjotin/tests/test_oidc.py index 134d3842..821ee55c 100644 --- a/palvelutarjotin/tests/test_oidc.py +++ b/palvelutarjotin/tests/test_oidc.py @@ -1,12 +1,13 @@ import contextlib import datetime +from unittest import mock + import jwt from authlib.jose.rfc7519.claims import JWTClaims from django.test import override_settings, TestCase from django.test.client import RequestFactory from django.utils import timezone from freezegun import freeze_time -from unittest import mock from organisations.factories import UserFactory from palvelutarjotin.oidc import GraphQLApiTokenAuthentication diff --git a/palvelutarjotin/urls.py b/palvelutarjotin/urls.py index a29c6c15..0047c3f6 100644 --- a/palvelutarjotin/urls.py +++ b/palvelutarjotin/urls.py @@ -1,4 +1,5 @@ import json + from django.conf import settings from django.conf.urls.static import static from django.http import HttpResponse diff --git a/palvelutarjotin/wsgi.py b/palvelutarjotin/wsgi.py index 6031943d..bf31e030 100644 --- a/palvelutarjotin/wsgi.py +++ b/palvelutarjotin/wsgi.py @@ -8,6 +8,7 @@ """ import os + from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SETTINGS_MODULE", "palvelutarjotin.settings") diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..14d134a6 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,40 @@ +[tool.ruff] +extend-exclude = ["migrations", "snapshots"] + +[tool.ruff.lint] +# See https://docs.astral.sh/ruff/rules/ for documentation of rules +extend-select = [ + "C90", # Enable mccabe (C90) rules + "E", # Enable pycodestyle error (E) rules + "F", # Enable Pyflakes (F) rules + "I", # Enable isort (I) rules + "W", # Enable pycodestyle warning (W) rules +] + +[tool.ruff.lint.isort] +# isort options for ruff: +# https://docs.astral.sh/ruff/settings/#lintisort +order-by-type = false # Don't use type (i.e. case) to sort imports + +[tool.ruff.format] +docstring-code-format = true # Format code in docstrings + +[tool.coverage.run] +# Coverage run options: +# https://coverage.readthedocs.io/en/latest/config.html#run +branch = true +omit = ["*migrations*", "*site-packages*", "*venv*"] + +[tool.pytest.ini_options] +# pytest-django options: +# https://pytest-django.readthedocs.io/en/latest/configuring_django.html +DJANGO_SETTINGS_MODULE = "palvelutarjotin.settings" + +# pytest options: +# https://docs.pytest.org/en/stable/reference/reference.html#configuration-options +norecursedirs = ["node_modules", ".git", "venv*"] +doctest_optionflags = [ + "NORMALIZE_WHITESPACE", + "IGNORE_EXCEPTION_DETAIL", + "ALLOW_UNICODE", +] diff --git a/release-please-config.json b/release-please-config.json index 229ecf59..9ed49cce 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -4,7 +4,8 @@ "packages": { ".": { "release-type": "python", - "package-name": "palvelutarjotin" + "package-name": "palvelutarjotin", + "extra-files": ["pyproject.toml"] } }, "plugins": ["sentence-case"] diff --git a/reports/admin.py b/reports/admin.py index 4cdf2160..0f3de555 100644 --- a/reports/admin.py +++ b/reports/admin.py @@ -1,4 +1,5 @@ import logging + from django import forms from django.contrib import admin, messages from django.db.models import F diff --git a/reports/factories.py b/reports/factories.py index 65b045e9..f94b6ba0 100644 --- a/reports/factories.py +++ b/reports/factories.py @@ -9,3 +9,4 @@ class EnrolmentReportFactory(factory.django.DjangoModelFactory): class Meta: model = EnrolmentReport + skip_postgeneration_save = True # Not needed after factory v4.0.0 diff --git a/reports/management/commands/sync_enrolment_reports.py b/reports/management/commands/sync_enrolment_reports.py index 3c65a00b..cf5669a5 100644 --- a/reports/management/commands/sync_enrolment_reports.py +++ b/reports/management/commands/sync_enrolment_reports.py @@ -1,4 +1,5 @@ from datetime import datetime + from django.core.management.base import BaseCommand from reports.services import sync_enrolment_reports diff --git a/reports/models.py b/reports/models.py index 1b9c835e..17b2c1e3 100644 --- a/reports/models.py +++ b/reports/models.py @@ -1,10 +1,11 @@ import logging from datetime import datetime +from typing import Optional + from django.contrib.postgres.fields import ArrayField from django.db import models from django.utils.translation import gettext_lazy as _ from geopy import distance -from typing import Optional import occurrences.models as occurrences_models import reports.services as reports_services diff --git a/reports/serializers.py b/reports/serializers.py index efca2973..6107c98b 100644 --- a/reports/serializers.py +++ b/reports/serializers.py @@ -1,6 +1,7 @@ -from rest_framework import serializers from typing import List, Optional +from rest_framework import serializers + from reports.models import EnrolmentReport @@ -85,9 +86,9 @@ def to_representation(self, value: list) -> Optional[dict]: result = { "ocd_ids": value, **{ - self.translations[key] - if key in self.translations - else key: value.capitalize() + ( + self.translations[key] if key in self.translations else key + ): value.capitalize() for (key, value) in pairs }, } @@ -125,8 +126,7 @@ def to_internal_value(self, data: dict) -> list: "ocd-division/country:fi/kunta:helsinki/kaupunginosa:pasila", "ocd-division/country:fi/kunta:helsinki/peruspiiri:pasila", "ocd-division/country:fi/kunta:helsinki", - ] - """ + ]""" if "ocd_ids" in data: return data["ocd_ids"] diff --git a/reports/services.py b/reports/services.py index bd060c7a..332e24e9 100644 --- a/reports/services.py +++ b/reports/services.py @@ -1,7 +1,8 @@ from datetime import datetime -from django.db import models from typing import List, Optional, Union +from django.db import models + import occurrences.models as occurrences_models import reports.models as report_models from occurrences.event_api_services import fetch_event_as_json, fetch_place_as_json diff --git a/reports/tests/test_commands.py b/reports/tests/test_commands.py index 197d29b1..30db8c9a 100644 --- a/reports/tests/test_commands.py +++ b/reports/tests/test_commands.py @@ -1,7 +1,8 @@ +from unittest.mock import patch + import pytest from django.core.management import call_command from django.test import TestCase -from unittest.mock import patch from occurrences.event_api_services import fetch_event_as_json from occurrences.factories import EnrolmentFactory diff --git a/reports/tests/test_models.py b/reports/tests/test_models.py index 6015eff0..8fce174e 100644 --- a/reports/tests/test_models.py +++ b/reports/tests/test_models.py @@ -1,5 +1,6 @@ -import dateutil.parser import math + +import dateutil.parser import pytest from freezegun import freeze_time diff --git a/reports/tests/test_views.py b/reports/tests/test_views.py index 61100325..08f8fa57 100644 --- a/reports/tests/test_views.py +++ b/reports/tests/test_views.py @@ -1,5 +1,7 @@ -import pytest from datetime import datetime, timedelta +from unittest import mock + +import pytest from django.contrib.auth.models import Permission from django.contrib.contenttypes.models import ContentType from django.test import override_settings, TestCase @@ -7,11 +9,10 @@ from django.utils import timezone from django.views.generic import TemplateView from freezegun import freeze_time -from graphql_relay.node.node import to_global_id +from graphql_relay import to_global_id from parameterized import parameterized from rest_framework import status from rest_framework.test import APIClient -from unittest import mock from occurrences.factories import ( EnrolmentFactory, diff --git a/reports/views.py b/reports/views.py index 491934a0..f125b24e 100644 --- a/reports/views.py +++ b/reports/views.py @@ -1,6 +1,8 @@ import csv import datetime import logging +from functools import lru_cache + from django.conf import settings from django.contrib import messages from django.contrib.admin.views.decorators import staff_member_required @@ -13,7 +15,6 @@ from django.utils.translation import gettext as _ from django.views.decorators.http import require_http_methods from django.views.generic import ListView -from functools import lru_cache from rest_framework import generics from rest_framework.authentication import SessionAuthentication from rest_framework.permissions import DjangoModelPermissions, IsAdminUser @@ -415,9 +416,10 @@ def get_place_from_linkedevents_or_cache(place_id): person_email_address = enrolment.person.email_address person_phone_number = enrolment.person.phone_number elif enrolment.person_deleted_at: - person_email_address = ( - person_phone_number - ) = f"{_('Deleted')} {enrolment.person_deleted_at.strftime(self.DATE_FORMAT)}" # noqa: E501 + person_email_address = person_phone_number = ( + f"{_('Deleted')} " + + f"{enrolment.person_deleted_at.strftime(self.DATE_FORMAT)}" + ) else: person_email_address = person_phone_number = "" diff --git a/requirements-dev.in b/requirements-dev.in index 09b94f85..859c7c7c 100644 --- a/requirements-dev.in +++ b/requirements-dev.in @@ -1,9 +1,6 @@ -c requirements.txt -black -flake8 freezegun ipython -isort pytest pytest-cov pytest-django @@ -12,3 +9,4 @@ pre-commit responses parameterized requests-mock +ruff diff --git a/requirements-dev.txt b/requirements-dev.txt index 13e91b03..603051d4 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,129 +1,102 @@ # -# This file is autogenerated by pip-compile with Python 3.9 +# This file is autogenerated by pip-compile with Python 3.11 # by the following command: # # pip-compile requirements-dev.in # -appnope==0.1.4 - # via ipython -asttokens==2.2.1 +asttokens==2.4.1 # via stack-data -backcall==0.2.0 - # via ipython -black==23.3.0 - # via -r requirements-dev.in -certifi==2022.12.7 +certifi==2024.8.30 # via # -c requirements.txt # requests -cfgv==3.3.1 +cfgv==3.4.0 # via pre-commit -charset-normalizer==3.1.0 +charset-normalizer==3.3.2 # via # -c requirements.txt # requests -click==8.1.3 - # via black -coverage[toml]==7.2.3 +coverage[toml]==7.6.1 # via pytest-cov decorator==5.1.1 # via ipython -distlib==0.3.6 +distlib==0.3.8 # via virtualenv -exceptiongroup==1.1.1 - # via pytest -executing==1.2.0 +executing==2.1.0 # via stack-data fastdiff==0.3.0 # via snapshottest -filelock==3.12.0 +filelock==3.16.1 # via virtualenv -flake8==6.0.0 +freezegun==1.5.1 # via -r requirements-dev.in -freezegun==1.2.2 - # via -r requirements-dev.in -identify==2.5.22 +identify==2.6.1 # via pre-commit -idna==3.4 +idna==3.10 # via # -c requirements.txt # requests iniconfig==2.0.0 # via pytest -ipython==8.12.0 - # via -r requirements-dev.in -isort==5.12.0 +ipython==8.28.0 # via -r requirements-dev.in -jedi==0.18.2 +jedi==0.19.1 # via ipython -matplotlib-inline==0.1.6 +matplotlib-inline==0.1.7 # via ipython -mccabe==0.7.0 - # via flake8 -mypy-extensions==1.0.0 - # via black -nodeenv==1.7.0 +nodeenv==1.9.1 # via pre-commit -packaging==23.1 +packaging==24.1 # via # -c requirements.txt - # black # pytest parameterized==0.9.0 # via -r requirements-dev.in -parso==0.8.3 +parso==0.8.4 # via jedi -pathspec==0.11.1 - # via black -pexpect==4.8.0 - # via ipython -pickleshare==0.7.5 +pexpect==4.9.0 # via ipython -platformdirs==3.2.0 - # via - # black - # virtualenv -pluggy==1.0.0 +platformdirs==4.3.6 + # via virtualenv +pluggy==1.5.0 # via pytest -pre-commit==3.2.2 +pre-commit==4.0.1 # via -r requirements-dev.in -prompt-toolkit==3.0.38 +prompt-toolkit==3.0.48 # via ipython ptyprocess==0.7.0 # via pexpect -pure-eval==0.2.2 +pure-eval==0.2.3 # via stack-data -pycodestyle==2.10.0 - # via flake8 -pyflakes==3.0.1 - # via flake8 -pygments==2.15.1 +pygments==2.18.0 # via ipython -pytest==7.3.1 +pytest==8.3.3 # via # -r requirements-dev.in # pytest-cov # pytest-django -pytest-cov==4.0.0 +pytest-cov==5.0.0 # via -r requirements-dev.in -pytest-django==4.5.2 +pytest-django==4.9.0 # via -r requirements-dev.in -python-dateutil==2.8.2 +python-dateutil==2.9.0.post0 # via # -c requirements.txt # freezegun -pyyaml==6.0 +pyyaml==6.0.2 # via # pre-commit # responses -requests==2.28.2 +requests==2.32.3 # via # -c requirements.txt # requests-mock # responses requests-mock==1.12.1 # via -r requirements-dev.in -responses==0.23.1 +responses==0.25.3 + # via -r requirements-dev.in +ruff==0.6.9 # via -r requirements-dev.in six==1.16.0 # via @@ -133,38 +106,28 @@ six==1.16.0 # snapshottest snapshottest==0.6.0 # via -r requirements-dev.in -stack-data==0.6.2 +stack-data==0.6.3 # via ipython -termcolor==2.3.0 +termcolor==2.5.0 # via snapshottest -tomli==2.0.1 - # via - # black - # coverage - # pytest -traitlets==5.9.0 +traitlets==5.14.3 # via # ipython # matplotlib-inline -types-pyyaml==6.0.12.9 - # via responses -typing-extensions==4.5.0 +typing-extensions==4.12.2 # via - # black + # -c requirements.txt # ipython -urllib3==1.26.15 +urllib3==2.2.3 # via # -c requirements.txt # requests # responses -virtualenv==20.22.0 +virtualenv==20.26.6 # via pre-commit wasmer==1.1.0 # via fastdiff wasmer-compiler-cranelift==1.1.0 # via fastdiff -wcwidth==0.2.6 +wcwidth==0.2.13 # via prompt-toolkit - -# The following packages are considered to be unsafe in a requirements file: -# setuptools diff --git a/requirements-prod.txt b/requirements-prod.txt index 420263ee..024171f1 100644 --- a/requirements-prod.txt +++ b/requirements-prod.txt @@ -1,8 +1,8 @@ # -# This file is autogenerated by pip-compile with Python 3.9 +# This file is autogenerated by pip-compile with Python 3.11 # by the following command: # # pip-compile requirements-prod.in # -uwsgi==2.0.21 +uwsgi==2.0.27 # via -r requirements-prod.in diff --git a/requirements.in b/requirements.in index f64bdd4c..62af8454 100644 --- a/requirements.in +++ b/requirements.in @@ -1,18 +1,15 @@ -Django~=3.2.5 +Django~=4.2.16 django-admin-list-filter-dropdown django-cors-headers django-environ django-graphql-jwt -django-helusers>0.6.0 -django-ilmoitin[graphql_api]>=0.6.0 -django-filter>=2.4 +django-helusers +django-ilmoitin +django-filter django-axes factory-boy geopy -#There are incompatible versions in the resolved dependencies: -# graphql-core<3,>=2.1 (from django-ilmoitin[graphql_api]==0.6.0->-r requirements.in (line 7)) -# graphql-core<4,>=3.1.0 (from graphene-django==3.0.0->-r requirements.in (line 12)) -graphene-django<3.0.0 #Could not find a version that matches graphql-core<3,<4,>=2.1,>=3.1.0 (from graphene-django==3.0.0->-r requirements.in (line 12)) +graphene-django graphene-file-upload psycopg2-binary requests @@ -21,6 +18,7 @@ importlib_metadata django-utils-six drf-oidc-auth social-auth-app-django -certifi>=2021.5.30 -urllib3>=1.25.11 -helsinki-profile-gdpr-api \ No newline at end of file +certifi +urllib3 +helsinki-profile-gdpr-api +pytz \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 9355284c..dd1e582d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,38 +1,41 @@ # -# This file is autogenerated by pip-compile with Python 3.9 +# This file is autogenerated by pip-compile with Python 3.11 # by the following command: # # pip-compile requirements.in # -aniso8601==7.0.0 +aniso8601==9.0.1 # via graphene -asgiref==3.6.0 - # via django -authlib==1.2.0 +asgiref==3.8.1 + # via + # django + # django-axes + # django-cors-headers +authlib==1.3.2 # via drf-oidc-auth -cachetools==5.3.0 +cachetools==5.5.0 # via django-helusers -certifi==2022.12.7 +certifi==2024.8.30 # via # -r requirements.in # requests # sentry-sdk -cffi==1.15.1 +cffi==1.17.1 # via cryptography -charset-normalizer==3.1.0 +charset-normalizer==3.3.2 # via requests -cryptography==40.0.2 +cryptography==43.0.1 # via # authlib # drf-oidc-auth # social-auth-core -defusedxml==0.7.1 +defusedxml==0.8.0rc2 # via # python3-openid # social-auth-core deprecation==2.1.0 # via django-helusers -django==3.2.18 +django==4.2.16 # via # -r requirements.in # django-anymail @@ -51,33 +54,31 @@ django==3.2.18 # social-auth-app-django django-admin-list-filter-dropdown==1.0.3 # via -r requirements.in -django-anymail==9.1 +django-anymail==12.0 # via django-ilmoitin -django-axes==5.41.1 +django-axes==7.0.0 # via -r requirements.in -django-cors-headers==3.14.0 +django-cors-headers==4.4.0 # via -r requirements.in django-environ==0.11.2 # via -r requirements.in -django-filter==23.1 +django-filter==24.3 # via -r requirements.in -django-graphql-jwt==0.3.4 +django-graphql-jwt==0.4.0 # via -r requirements.in django-helusers==0.13.0 # via # -r requirements.in # helsinki-profile-gdpr-api -django-ilmoitin[graphql_api]==0.7.0 +django-ilmoitin==0.7.0 # via -r requirements.in -django-ipware==5.0.0 - # via django-axes -django-mailer==2.2 +django-mailer==2.3.2 # via django-ilmoitin django-parler==2.3 # via django-ilmoitin django-utils-six==2.0 # via -r requirements.in -djangorestframework==3.14.0 +djangorestframework==3.15.2 # via # drf-oidc-auth # helsinki-profile-gdpr-api @@ -85,84 +86,76 @@ drf-oidc-auth==3.0.0 # via # -r requirements.in # helsinki-profile-gdpr-api -ecdsa==0.18.0 +ecdsa==0.19.0 # via python-jose -factory-boy==3.2.1 +factory-boy==3.3.1 # via -r requirements.in -faker==18.4.0 +faker==30.3.0 # via factory-boy geographiclib==2.0 # via geopy -geopy==2.3.0 +geopy==2.4.1 # via -r requirements.in -graphene==2.1.9 +graphene==3.3 # via # django-graphql-jwt - # django-ilmoitin # graphene-django -graphene-django==2.15.0 +graphene-django==3.2.2 # via # -r requirements.in # django-graphql-jwt - # django-ilmoitin graphene-file-upload==1.3.0 # via -r requirements.in -graphql-core==2.3.2 +graphql-core==3.2.4 # via - # django-ilmoitin # graphene # graphene-django # graphql-relay -graphql-relay==2.0.1 +graphql-relay==3.2.0 # via - # django-ilmoitin # graphene + # graphene-django helsinki-profile-gdpr-api==0.2.0 # via -r requirements.in -idna==3.4 +idna==3.10 # via requests -importlib-metadata==6.6.0 +importlib-metadata==8.5.0 # via -r requirements.in -jinja2==3.1.2 +jinja2==3.1.4 # via django-ilmoitin lockfile==0.12.2 # via django-mailer -markupsafe==2.1.2 +markupsafe==3.0.1 # via jinja2 oauthlib==3.2.2 # via # requests-oauthlib # social-auth-core -packaging==23.1 +packaging==24.1 # via deprecation promise==2.3 - # via - # graphene-django - # graphql-core - # graphql-relay -psycopg2-binary==2.9.6 + # via graphene-django +psycopg2-binary==2.9.9 # via -r requirements.in -pyasn1==0.5.0 +pyasn1==0.6.1 # via # python-jose # rsa -pycparser==2.21 +pycparser==2.22 # via cffi -pyjwt==2.6.0 +pyjwt==2.9.0 # via # django-graphql-jwt # social-auth-core -python-dateutil==2.8.2 +python-dateutil==2.9.0.post0 # via faker python-jose==3.3.0 # via django-helusers python3-openid==3.2.0 # via social-auth-core -pytz==2023.3 - # via - # django - # djangorestframework -requests==2.28.2 +pytz==2024.2 + # via -r requirements.in +requests==2.32.3 # via # -r requirements.in # django-anymail @@ -170,42 +163,33 @@ requests==2.28.2 # drf-oidc-auth # requests-oauthlib # social-auth-core -requests-oauthlib==1.3.1 +requests-oauthlib==2.0.0 # via social-auth-core rsa==4.9 # via python-jose -rx==1.6.3 - # via graphql-core -sentry-sdk==1.20.0 +sentry-sdk==2.16.0 # via -r requirements.in -singledispatch==4.0.0 - # via graphene-django six==1.16.0 # via - # django-mailer # ecdsa - # graphene - # graphene-django # graphene-file-upload - # graphql-core - # graphql-relay # promise # python-dateutil -social-auth-app-django==5.2.0 +social-auth-app-django==5.4.2 # via -r requirements.in -social-auth-core==4.4.2 +social-auth-core==4.5.4 # via social-auth-app-django -sqlparse==0.4.4 +sqlparse==0.5.1 # via django text-unidecode==1.3 # via graphene-django -urllib3==1.26.15 +typing-extensions==4.12.2 + # via faker +urllib3==2.2.3 # via # -r requirements.in + # django-anymail # requests # sentry-sdk -zipp==3.15.0 +zipp==3.20.2 # via importlib-metadata - -# The following packages are considered to be unsafe in a requirements file: -# setuptools diff --git a/servicemap/rest_client.py b/servicemap/rest_client.py index b468d110..38d82d3e 100644 --- a/servicemap/rest_client.py +++ b/servicemap/rest_client.py @@ -1,6 +1,7 @@ -import requests from typing import Optional +import requests + class ServicemapApiClient: CONNECTION_TIMEOUT = 20 @@ -35,9 +36,9 @@ def list_helsinki_schools_and_kindergartens(self, filters: Optional[dict] = None 1097, # Basic education ] payload = filters or {} - payload[ - "arealcity" - ] = "91" # Helsinki - https://www.hel.fi/palvelukarttaws/rest/v4/arealcity/ + payload["arealcity"] = ( + "91" # Helsinki - https://www.hel.fi/palvelukarttaws/rest/v4/arealcity/ + ) payload["ontologytree"] = "+".join(str(node) for node in service_nodes) # NOTE: It is important that the "+" is not encoded to "%2B" in the URL. payload_str = "&".join("%s=%s" % (k, v) for k, v in payload.items()) diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 22d973e6..00000000 --- a/setup.cfg +++ /dev/null @@ -1,29 +0,0 @@ -[flake8] -exclude = migrations,snapshots -max-line-length = 88 -max-complexity = 10 - -[tool:pytest] -DJANGO_SETTINGS_MODULE = palvelutarjotin.settings -norecursedirs = node_modules .git venv* -doctest_optionflags = NORMALIZE_WHITESPACE IGNORE_EXCEPTION_DETAIL ALLOW_UNICODE - -[coverage:run] -branch = True -omit = *migrations*,*site-packages*,*venv* - -[isort] -known_first_party=common,palvelutarjotin -known_standard_library=token,tokenize,enum,importlib -default_section = THIRDPARTY -atomic=true -combine_as_imports=false -indent=4 -length_sort=false -multi_line_output=3 -order_by_type=false -skip=migrations,venv -include_trailing_comma = True -force_grid_wrap = 0 -use_parentheses = True -line_length = 88 diff --git a/verification_token/factories.py b/verification_token/factories.py index c7a10a19..1bb18499 100644 --- a/verification_token/factories.py +++ b/verification_token/factories.py @@ -23,6 +23,7 @@ class VerificationTokenFactory(factory.django.DjangoModelFactory): class Meta: exclude = ["content_object"] abstract = True + skip_postgeneration_save = True # Not needed after factory v4.0.0 class EnrolmentVerificationTokenFactory(VerificationTokenFactory): @@ -34,3 +35,4 @@ class EnrolmentVerificationTokenFactory(VerificationTokenFactory): class Meta: model = VerificationToken + skip_postgeneration_save = True # Not needed after factory v4.0.0 diff --git a/verification_token/models.py b/verification_token/models.py index a11ce1ae..e6d059ed 100644 --- a/verification_token/models.py +++ b/verification_token/models.py @@ -1,4 +1,6 @@ from datetime import timedelta +from secrets import token_urlsafe + from django.conf import settings from django.contrib.contenttypes.fields import GenericForeignKey from django.contrib.contenttypes.models import ContentType @@ -6,7 +8,6 @@ from django.db.models import Q from django.utils import timezone from django.utils.translation import gettext_lazy as _ -from secrets import token_urlsafe from organisations.models import Person diff --git a/verification_token/tests/test_models.py b/verification_token/tests/test_models.py index 34ead23e..f91a5ff9 100644 --- a/verification_token/tests/test_models.py +++ b/verification_token/tests/test_models.py @@ -1,5 +1,6 @@ -import pytest from datetime import timedelta + +import pytest from django.utils import timezone from occurrences.factories import EnrolmentFactory