Merge pull request #21368 from edx/private_to_public_53f6d7f
Mergeback PR from private to public.
This commit is contained in:
@@ -67,6 +67,17 @@ class SocialLinkSerializer(serializers.ModelSerializer):
|
||||
model = SocialLink
|
||||
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):
|
||||
"""
|
||||
|
||||
@@ -217,7 +217,7 @@ class TestAccountApi(UserSettingsEventTestMixin, EmailTemplateTagMixin, Retireme
|
||||
social_links = [
|
||||
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})
|
||||
|
||||
def test_update_success_for_enterprise(self):
|
||||
|
||||
Reference in New Issue
Block a user