From 0cc69de8a56adff1b8dcf1c9f3980c49698157dc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Oct 2023 03:47:27 +0000 Subject: [PATCH 1/2] Bump urllib3 from 1.26.16 to 1.26.17 Bumps [urllib3](https://github.com/urllib3/urllib3) from 1.26.16 to 1.26.17. - [Release notes](https://github.com/urllib3/urllib3/releases) - [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst) - [Commits](https://github.com/urllib3/urllib3/compare/1.26.16...1.26.17) --- updated-dependencies: - dependency-name: urllib3 dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- requirements_test.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 98f4aabc..2a723fb1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -277,7 +277,7 @@ tzdata==2023.3 # django-celery-beat uritemplate==4.1.1 # via drf-spectacular -urllib3==1.26.16 +urllib3==1.26.17 # via # -r requirements.in # botocore diff --git a/requirements_test.txt b/requirements_test.txt index 4efccdba..b05dd051 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -364,7 +364,7 @@ tzdata==2023.3 # django-celery-beat uritemplate==4.1.1 # via drf-spectacular -urllib3==1.26.16 +urllib3==1.26.17 # via # -r requirements.in # botocore From 0d052f286ad649792cf48899f8ddb61d1b37a37c Mon Sep 17 00:00:00 2001 From: Timothy Patterson Date: Tue, 3 Oct 2023 10:18:39 +0100 Subject: [PATCH 2/2] update casing --- activitystream/serializers.py | 22 +++++++++++++--------- tests/activitystream/test_serializers.py | 10 +++++----- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/activitystream/serializers.py b/activitystream/serializers.py index baf2442e..aa4a1092 100644 --- a/activitystream/serializers.py +++ b/activitystream/serializers.py @@ -4,18 +4,22 @@ class WagtailPageSerializer(serializers.Serializer): + prefix = 'dit:cmsContent' + subtype = 'international' + operation = 'Update' + def get_cms_content_for_obj(self, obj): try: result = dict( - id='dit:cmsContent:international:' + str(obj.id), - type='dit:cmsContent', + id=f'{self.prefix}:{self.subtype}:{obj.id}', + type=self.prefix, title=obj.title, url=settings.APP_URL_GREAT_INTERNATIONAL+'content'+obj.url, - seo_title=obj.seo_title, - search_description=obj.search_description, - first_published_at=obj.first_published_at.isoformat(), - last_published_at=obj.last_published_at.isoformat(), - content_type_id=obj.content_type_id, + seoTitle=obj.seo_title, + searchDescription=obj.search_description, + firstPublishedAt=obj.first_published_at.isoformat(), + lastPublishedAt=obj.last_published_at.isoformat(), + contentTypeId=obj.content_type_id, content=f"{PageCache.get(obj.id, lang='en-gb')}", ) except Exception as e: @@ -25,8 +29,8 @@ def get_cms_content_for_obj(self, obj): def to_representation(self, obj): return { - 'id': ('dit:cmsContent:international:' + str(obj.id) + ':Update'), - 'type': 'Update', + 'id': f'{self.prefix}:{self.subtype}:{obj.id}:{self.operation}', + 'type': self.operation, 'published': obj.last_published_at.isoformat(), 'object': self.get_cms_content_for_obj(obj), } diff --git a/tests/activitystream/test_serializers.py b/tests/activitystream/test_serializers.py index 84ce8919..5b9a494f 100644 --- a/tests/activitystream/test_serializers.py +++ b/tests/activitystream/test_serializers.py @@ -24,11 +24,11 @@ def test_wagtail_page_serializer(international_site): 'type': 'dit:cmsContent', 'title': article.title, 'url': settings.APP_URL_GREAT_INTERNATIONAL+'content'+article.url, - 'seo_title': article.seo_title, - 'search_description': article.search_description, - 'first_published_at': article.first_published_at.isoformat(), - 'last_published_at': article.last_published_at.isoformat(), - 'content_type_id': article.content_type_id, + 'seoTitle': article.seo_title, + 'searchDescription': article.search_description, + 'firstPublishedAt': article.first_published_at.isoformat(), + 'lastPublishedAt': article.last_published_at.isoformat(), + 'contentTypeId': article.content_type_id, 'content': "None", }, }