diff --git a/siteapi/v1/serializers/config.py b/siteapi/v1/serializers/config.py index 253669a1a..5b8b0fb86 100644 --- a/siteapi/v1/serializers/config.py +++ b/siteapi/v1/serializers/config.py @@ -280,9 +280,10 @@ def update(self, instance, validated_data): # pylint: disable=too-many-locals alipay_config_data = validated_data.pop('alipay_config', None) if alipay_config_data: - serializer = AlipayConfigSerializer(AlipayConfig.get_current(), alipay_config_data, partial=True) - serializer.is_valid(raise_exception=True) - serializer.save() + if alipay_config_data["app_id"] != '': + serializer = AlipayConfigSerializer(AlipayConfig.get_current(), alipay_config_data, partial=True) + serializer.is_valid(raise_exception=True) + serializer.save() qq_config_data = validated_data.pop('qq_config', None) if qq_config_data: diff --git a/test/tests/test_normal_user_view.py b/test/tests/test_normal_user_view.py index fb3506ace..e27c02276 100644 --- a/test/tests/test_normal_user_view.py +++ b/test/tests/test_normal_user_view.py @@ -40,7 +40,7 @@ def app_black_list(self): ''' 黑名单:部门一成员13899990006为黑名单人员,不可见应用十 ''' - user = User.objects.filter(username='13899990006') + user = User.objects.filter(username='13899990006').first() client = self.login_as(user) res = client.get(reverse('siteapi:ucenter_app_list')) self.assertEqual(res.json()['count'], 0)