Merged in [9649] from rjsparks@nostrum.com:

Provide a session type for sessions created to say a group is not meeting. Add a test for the no_meeting view. Fixes #1720.
 - Legacy-Id: 9660
Note: SVN reference [9649] has been migrated to Git commit 0ce13839009aed0c946750989ea0a074517028ba
This commit is contained in:
Henrik Levkowetz 2015-06-03 16:33:55 +00:00
parent 41dcd53842
commit 1c54a13f68
2 changed files with 23 additions and 2 deletions

View file

@ -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

View file

@ -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