Skip to content

Commit

Permalink
fix: removew assumption about what pks tests milestones get (#8243)
Browse files Browse the repository at this point in the history
  • Loading branch information
rjsparks authored Nov 20, 2024
1 parent c3e0d28 commit 51a76c6
Showing 1 changed file with 32 additions and 29 deletions.
61 changes: 32 additions & 29 deletions ietf/group/tests_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -1431,15 +1431,15 @@ def create_test_milestones(self):
RoleFactory(group=group,name_id='chair',person=PersonFactory(user__username='marschairman'))
draft = WgDraftFactory(group=group)

m1 = GroupMilestone.objects.create(id=1,
m1 = GroupMilestone.objects.create(
group=group,
desc="Test 1",
due=date_today(DEADLINE_TZINFO),
resolved="",
state_id="active")
m1.docs.set([draft])

m2 = GroupMilestone.objects.create(id=2,
m2 = GroupMilestone.objects.create(
group=group,
desc="Test 2",
due=date_today(DEADLINE_TZINFO),
Expand Down Expand Up @@ -1580,13 +1580,14 @@ def test_accept_milestone(self):
events_before = group.groupevent_set.count()

# add
r = self.client.post(url, { 'prefix': "m1",
'm1-id': m1.id,
'm1-desc': m1.desc,
'm1-due': m1.due.strftime("%B %Y"),
'm1-resolved': m1.resolved,
'm1-docs': pklist(m1.docs),
'm1-review': "accept",
mstr = f"m{m1.id}"
r = self.client.post(url, { 'prefix': mstr,
f'{mstr}-id': m1.id,
f'{mstr}-desc': m1.desc,
f'{mstr}-due': m1.due.strftime("%B %Y"),
f'{mstr}-resolved': m1.resolved,
f'{mstr}-docs': pklist(m1.docs),
f'{mstr}-review': "accept",
'action': "save",
})
self.assertEqual(r.status_code, 302)
Expand All @@ -1606,13 +1607,14 @@ def test_delete_milestone(self):
events_before = group.groupevent_set.count()

# delete
r = self.client.post(url, { 'prefix': "m1",
'm1-id': m1.id,
'm1-desc': m1.desc,
'm1-due': m1.due.strftime("%B %Y"),
'm1-resolved': "",
'm1-docs': pklist(m1.docs),
'm1-delete': "checked",
mstr = f"m{m1.id}"
r = self.client.post(url, { 'prefix': mstr,
f'{mstr}-id': m1.id,
f'{mstr}-desc': m1.desc,
f'{mstr}-due': m1.due.strftime("%B %Y"),
f'{mstr}-resolved': "",
f'{mstr}-docs': pklist(m1.docs),
f'{mstr}-delete': "checked",
'action': "save",
})
self.assertEqual(r.status_code, 302)
Expand All @@ -1635,13 +1637,14 @@ def test_edit_milestone(self):

due = self.last_day_of_month(date_today(DEADLINE_TZINFO) + datetime.timedelta(days=365))

mstr = f"m{m1.id}"
# faulty post
r = self.client.post(url, { 'prefix': "m1",
'm1-id': m1.id,
'm1-desc': "", # no description
'm1-due': due.strftime("%B %Y"),
'm1-resolved': "",
'm1-docs': doc_pks,
r = self.client.post(url, { 'prefix': mstr,
f'{mstr}-id': m1.id,
f'{mstr}-desc': "", # no description
f'{mstr}-due': due.strftime("%B %Y"),
f'{mstr}-resolved': "",
f'{mstr}-docs': doc_pks,
'action': "save",
})
self.assertEqual(r.status_code, 200)
Expand All @@ -1653,13 +1656,13 @@ def test_edit_milestone(self):

# edit
mailbox_before = len(outbox)
r = self.client.post(url, { 'prefix': "m1",
'm1-id': m1.id,
'm1-desc': "Test 2 - changed",
'm1-due': due.strftime("%B %Y"),
'm1-resolved': "Done",
'm1-resolved_checkbox': "checked",
'm1-docs': doc_pks,
r = self.client.post(url, { 'prefix': mstr,
f'{mstr}-id': m1.id,
f'{mstr}-desc': "Test 2 - changed",
f'{mstr}-due': due.strftime("%B %Y"),
f'{mstr}-resolved': "Done",
f'{mstr}-resolved_checkbox': "checked",
f'{mstr}-docs': doc_pks,
'action': "save",
})
self.assertEqual(r.status_code, 302)
Expand Down

0 comments on commit 51a76c6

Please sign in to comment.