Skip to content

Commit

Permalink
Fix failing test
Browse files Browse the repository at this point in the history
This updates the ApiKeyForm to use boolean values instead of
characters and the profile view to use the cleaned_data attribute of
the form to check if API key regeneration was requested.
  • Loading branch information
replaceafill committed Oct 23, 2024
1 parent 5e80b3f commit eb8011b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/dashboard/src/components/accounts/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def save(self, commit=True):


class ApiKeyForm(forms.Form):
regenerate_api_key = forms.CharField(
regenerate_api_key = forms.BooleanField(
widget=forms.CheckboxInput,
label="Regenerate API key (shown below)?",
required=False,
Expand Down
2 changes: 1 addition & 1 deletion src/dashboard/src/components/accounts/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def profile(request):
form = ApiKeyForm(request.POST)
userprofileform = UserProfileForm(request.POST, instance=user_profile)
if form.is_valid() and userprofileform.is_valid():
if form["regenerate_api_key"] != "":
if form.cleaned_data["regenerate_api_key"]:
generate_api_key(user)
userprofileform.save()

Expand Down

0 comments on commit eb8011b

Please sign in to comment.