diff --git a/docs/topics/api/hero.rst b/docs/topics/api/hero.rst index 56ca32fdf1..6f7c24d3a0 100644 --- a/docs/topics/api/hero.rst +++ b/docs/topics/api/hero.rst @@ -44,7 +44,6 @@ small number of shelves this endpoint is not paginated. :>json string results[].gradient.start: The starting color for gradient - typically top or left. :>json string results[].gradient.end: The ending color for gradient - typically bottom or right. :>json string results[].featured_image: The image used to illustrate the item. - :>json string results[].heading: The heading for this item. May contain some HTML tags. :>json string|null results[].description: The description for this item, if any. May contain some HTML tags. :>json object results[].addon: The :ref:`add-on ` for this item if the addon is hosted on AMO. Either this field or ``external`` will be present. Only a subset of fields are present: ``id``, ``authors``, ``average_daily_users``, ``current_version`` (with only the ``id``, ``compatibility``, ``is_strict_compatibility_enabled`` and ``files`` fields present), ``guid``, ``icon_url``, ``name``, ``ratings``, ``previews``, ``slug``, ``theme_data``, ``type`` and ``url``. :>json object results[].external: The :ref:`add-on ` for this item if the addon is externally hosted. Either this field or ``addon`` will be present. Only a subset of fields are present: ``id``, ``guid``, ``homepage``, ``name`` and ``type``. diff --git a/src/olympia/hero/serializers.py b/src/olympia/hero/serializers.py index e9e9eac9a2..d3822550d7 100644 --- a/src/olympia/hero/serializers.py +++ b/src/olympia/hero/serializers.py @@ -17,14 +17,13 @@ class ExternalAddonSerializer(AddonSerializer): class PrimaryHeroShelfSerializer(serializers.ModelSerializer): description = serializers.CharField(source='disco_addon.description') featured_image = serializers.SerializerMethodField() - heading = serializers.CharField(source='disco_addon.heading') addon = DiscoveryAddonSerializer(source='disco_addon.addon') external = ExternalAddonSerializer(source='disco_addon.addon') class Meta: model = PrimaryHero fields = ('addon', 'description', 'external', 'featured_image', - 'gradient', 'heading') + 'gradient') def to_representation(self, instance): rep = super().to_representation(instance) diff --git a/src/olympia/hero/tests/test_serializers.py b/src/olympia/hero/tests/test_serializers.py index 57835fa5c4..e4478bcb00 100644 --- a/src/olympia/hero/tests/test_serializers.py +++ b/src/olympia/hero/tests/test_serializers.py @@ -11,18 +11,16 @@ from ..serializers import ( class TestPrimaryHeroShelfSerializer(TestCase): def test_basic(self): - addon = addon_factory(summary='Summary') + addon = addon_factory() hero = PrimaryHero.objects.create( disco_addon=DiscoveryItem.objects.create( - addon=addon, - custom_heading='Its a héading!'), + addon=addon, custom_description='Déscription'), image='foo.png', gradient_color='#123456') data = PrimaryHeroShelfSerializer(instance=hero).data assert data == { 'featured_image': hero.image_path, - 'heading': 'Its a héading!', - 'description': '
Summary
', + 'description': '
Déscription
', 'gradient': { 'start': GRADIENT_START_COLOR, 'end': '#123456' @@ -35,15 +33,12 @@ class TestPrimaryHeroShelfSerializer(TestCase): summary='Summary', homepage='https://foo.baa', version_kw={ 'channel': amo.RELEASE_CHANNEL_UNLISTED}) hero = PrimaryHero.objects.create( - disco_addon=DiscoveryItem.objects.create( - addon=addon, - custom_heading='Its a héading!'), + disco_addon=DiscoveryItem.objects.create(addon=addon), image='foo.png', gradient_color='#123456', is_external=True) assert PrimaryHeroShelfSerializer(instance=hero).data == { 'featured_image': hero.image_path, - 'heading': 'Its a héading!', 'description': '
Summary
', 'gradient': { 'start': GRADIENT_START_COLOR, diff --git a/src/olympia/hero/tests/test_views.py b/src/olympia/hero/tests/test_views.py index 9f7efbf88f..a8d40231ab 100644 --- a/src/olympia/hero/tests/test_views.py +++ b/src/olympia/hero/tests/test_views.py @@ -19,12 +19,12 @@ class TestPrimaryHeroShelfViewSet(TestCase): hero_a = PrimaryHero.objects.create( disco_addon=DiscoveryItem.objects.create( addon=addon_factory(), - custom_heading='Its a héading!'), + custom_description='Its a déscription!'), image='foo.png', gradient_color='#123456') hero_b = PrimaryHero.objects.create( disco_addon=DiscoveryItem.objects.create( - addon=addon_factory()), + addon=addon_factory(summary='fooo')), image='baa.png', gradient_color='#987654') hero_external = PrimaryHero.objects.create(