Skip to content

Commit

Permalink
fix: Print decoded key and fully clean up test nomcom (#6094)
Browse files Browse the repository at this point in the history
* fix: Delete Person records when deleting a test nomcom

* fix: Decode test nomcom private key before printing
  • Loading branch information
jennifer-richards authored Aug 8, 2023
1 parent 06c9f06 commit b574a6e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ietf/nomcom/management/commands/create_test_nomcom.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from ietf.nomcom.factories import nomcom_kwargs_for_year, NomComFactory, NomineePositionFactory, key
from ietf.person.factories import EmailFactory
from ietf.group.models import Group
from ietf.person.models import User
from ietf.person.models import Person, User

class Command(BaseCommand):
help = ("Create (or delete) a nomcom for test and development purposes.")
Expand All @@ -27,7 +27,9 @@ def handle(self, *args, **options):
if opt_delete:
if Group.objects.filter(acronym='nomcom7437').exists():
Group.objects.filter(acronym='nomcom7437').delete()
User.objects.filter(username__in=['testchair','testmember','testcandidate']).delete()
users_to_delete = ['testchair','testmember','testcandidate']
Person.objects.filter(user__username__in=users_to_delete).delete()
User.objects.filter(username__in=users_to_delete).delete()
self.stdout.write("Deleted test group 'nomcom7437' and its related objects.")
else:
self.stderr.write("test nomcom 'nomcom7437' does not exist; nothing to do.\n")
Expand Down Expand Up @@ -57,6 +59,6 @@ def handle(self, *args, **options):
position__nomcom=nc, position__name='Test Area Director', position__is_iesg_position=True,
)

self.stdout.write("%s\n" % key)
self.stdout.write("%s\n" % key.decode())
self.stdout.write("Nomcom 7437 created. The private key can also be found at any time\nin ietf/nomcom/factories.py. Note that it is NOT a secure key.\n")

0 comments on commit b574a6e

Please sign in to comment.