-
Notifications
You must be signed in to change notification settings - Fork 11
fix: adding enterprise branding for the unit tests #143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: release-ulmo
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -65,6 +65,10 @@ class ContextDataSerializer(serializers.Serializer): | |||||||||||||||||||||||
| countryCode = serializers.CharField(allow_null=True) | ||||||||||||||||||||||||
| welcomePageRedirectUrl = serializers.CharField(allow_null=True) | ||||||||||||||||||||||||
| pipelineUserDetails = serializers.SerializerMethodField() | ||||||||||||||||||||||||
| enterpriseBranding = EnterpriseBrandingSerializer( | ||||||||||||||||||||||||
| allow_null=True, | ||||||||||||||||||||||||
| required=False, | ||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
||||||||||||||||||||||||
| def to_representation(self, instance): | |
| """ | |
| Customize representation to omit the 'enterpriseBranding' key | |
| when there is no enterprise branding data. | |
| """ | |
| data = super().to_representation(instance) | |
| if data.get('enterpriseBranding') is None: | |
| data.pop('enterpriseBranding', None) | |
| return data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new tests cover the cases where
enterpriseBrandingis present (dict) and where it is entirely absent, but they don't cover the production-shaped case where the key exists with aNonevalue (the MFE context builder setsenterpriseBrandingtoNonewhen no enterprise is detected). Consider adding an assertion for theenterpriseBranding=Noneinput to lock down whether the serializer should emitenterpriseBranding: Noneor omit the key in that scenario.