Skip to content
Snippets Groups Projects
Unverified Commit b7392d80 authored by edx-pipeline-bot's avatar edx-pipeline-bot Committed by GitHub
Browse files

Merge pull request #21368 from edx/private_to_public_53f6d7f

Mergeback PR from private to public.
parents 1eda18a3 53f6d7fe
Branches
Tags
No related merge requests found
...@@ -67,6 +67,17 @@ class SocialLinkSerializer(serializers.ModelSerializer): ...@@ -67,6 +67,17 @@ class SocialLinkSerializer(serializers.ModelSerializer):
model = SocialLink model = SocialLink
fields = ("platform", "social_link") fields = ("platform", "social_link")
def validate_platform(self, platform):
"""
Validate that the platform value is one of (facebook, twitter or linkedin)
"""
valid_platforms = ["facebook", "twitter", "linkedin"]
if platform not in valid_platforms:
raise serializers.ValidationError(
u"The social platform must be facebook, twitter or linkedin"
)
return platform
class UserReadOnlySerializer(serializers.Serializer): class UserReadOnlySerializer(serializers.Serializer):
""" """
......
...@@ -217,7 +217,7 @@ class TestAccountApi(UserSettingsEventTestMixin, EmailTemplateTagMixin, Retireme ...@@ -217,7 +217,7 @@ class TestAccountApi(UserSettingsEventTestMixin, EmailTemplateTagMixin, Retireme
social_links = [ social_links = [
dict(platform="unsupported", social_link="https://www.unsupported.com/{}".format(self.user.username)) dict(platform="unsupported", social_link="https://www.unsupported.com/{}".format(self.user.username))
] ]
with self.assertRaises(AccountUpdateError): with self.assertRaises(AccountValidationError):
update_account_settings(self.user, {"social_links": social_links}) update_account_settings(self.user, {"social_links": social_links})
def test_update_success_for_enterprise(self): def test_update_success_for_enterprise(self):
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment