Skip to content

Commit

Permalink
Provide a session type for sessions created to say a group is not mee…
Browse files Browse the repository at this point in the history
…ting. Add a test for the no_meeting view. Fixes #1720. Commit ready for merge.

 - Legacy-Id: 9649
  • Loading branch information
rjsparks committed May 27, 2015
1 parent 45ce070 commit 0ce1383
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
21 changes: 20 additions & 1 deletion ietf/secr/sreq/tests.py
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion ietf/secr/sreq/views.py
Expand Up @@ -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
Expand Down

0 comments on commit 0ce1383

Please sign in to comment.