diff --git a/ietf/secr/sreq/tests.py b/ietf/secr/sreq/tests.py index 09328664d..b679a12b5 100644 --- a/ietf/secr/sreq/tests.py +++ b/ietf/secr/sreq/tests.py @@ -100,7 +100,26 @@ class EditRequestCase(TestCase): pass class NotMeetingCase(TestCase): - pass + + def test_not_meeting(self): + + make_test_data() + group = Group.objects.get(acronym='mars') + url = reverse('sessions_no_session',kwargs={'acronym':group.acronym}) + self.client.login(username="secretary", password="secretary+password") + + r = self.client.get(url,follow=True) + # If the view invoked by that get throws an exception (such as an integrity error), + # the traceback from this test will talk about a TransactionManagementError and + # yell about executing queries before the end of an 'atomic' block + + # This is a sign of a problem - a get shouldn't have a side-effect like this one does + self.assertEqual(r.status_code, 200) + self.assertTrue('A message was sent to notify not having a session' in r.content) + + r = self.client.get(url,follow=True) + self.assertEqual(r.status_code, 200) + self.assertTrue('is already marked as not meeting' in r.content) class RetrievePreviousCase(TestCase): pass diff --git a/ietf/secr/sreq/views.py b/ietf/secr/sreq/views.py index 292fff87f..a02347611 100644 --- a/ietf/secr/sreq/views.py +++ b/ietf/secr/sreq/views.py @@ -622,7 +622,9 @@ def no_session(request, acronym): requested=datetime.datetime.now(), requested_by=login, requested_duration=0, - status=SessionStatusName.objects.get(slug='notmeet')) + status=SessionStatusName.objects.get(slug='notmeet'), + type_id='session', + ) session_save(session) # send notification