Skip to content

Commit 0ce1383

Browse files
committed
Provide a session type for sessions created to say a group is not meeting. Add a test for the no_meeting view. Fixes ietf-tools#1720. Commit ready for merge.
- Legacy-Id: 9649
1 parent 45ce070 commit 0ce1383

2 files changed

Lines changed: 23 additions & 2 deletions

File tree

ietf/secr/sreq/tests.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,26 @@ class EditRequestCase(TestCase):
100100
pass
101101

102102
class NotMeetingCase(TestCase):
103-
pass
103+
104+
def test_not_meeting(self):
105+
106+
make_test_data()
107+
group = Group.objects.get(acronym='mars')
108+
url = reverse('sessions_no_session',kwargs={'acronym':group.acronym})
109+
self.client.login(username="secretary", password="secretary+password")
110+
111+
r = self.client.get(url,follow=True)
112+
# If the view invoked by that get throws an exception (such as an integrity error),
113+
# the traceback from this test will talk about a TransactionManagementError and
114+
# yell about executing queries before the end of an 'atomic' block
115+
116+
# This is a sign of a problem - a get shouldn't have a side-effect like this one does
117+
self.assertEqual(r.status_code, 200)
118+
self.assertTrue('A message was sent to notify not having a session' in r.content)
119+
120+
r = self.client.get(url,follow=True)
121+
self.assertEqual(r.status_code, 200)
122+
self.assertTrue('is already marked as not meeting' in r.content)
104123

105124
class RetrievePreviousCase(TestCase):
106125
pass

ietf/secr/sreq/views.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,9 @@ def no_session(request, acronym):
622622
requested=datetime.datetime.now(),
623623
requested_by=login,
624624
requested_duration=0,
625-
status=SessionStatusName.objects.get(slug='notmeet'))
625+
status=SessionStatusName.objects.get(slug='notmeet'),
626+
type_id='session',
627+
)
626628
session_save(session)
627629

628630
# send notification

0 commit comments

Comments
 (0)