Skip to content

Commit

Permalink
Allow "static_password" = null in recovery pwd API
Browse files Browse the repository at this point in the history
  • Loading branch information
np5 committed Aug 6, 2023
1 parent 1aca770 commit d39458f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion tests/mdm/test_api_recovery_password_configs_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ def test_create_recovery_password_config(self, post_event):
name = get_random_string(12)
with self.captureOnCommitCallbacks(execute=True) as callbacks:
response = self.post(reverse("mdm_api:recovery_password_configs"),
{"name": name})
{"name": name,
"static_password": None})
self.assertEqual(response.status_code, 201)
self.assertEqual(len(callbacks), 1)
rp_config = RecoveryPasswordConfig.objects.get(name=name)
Expand Down
2 changes: 1 addition & 1 deletion zentral/contrib/mdm/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def validate(self, data):


class RecoveryPasswordConfigSerializer(serializers.ModelSerializer):
static_password = serializers.CharField(required=False, source="get_static_password")
static_password = serializers.CharField(required=False, source="get_static_password", allow_null=True)

class Meta:
model = RecoveryPasswordConfig
Expand Down

0 comments on commit d39458f

Please sign in to comment.