Beispiel #1
0
 def test_add_hunt_its(self): #incomplete
     """
         **test_add_hunt_its** * Test that correct items are added
     """
     with patch('cr_hunt.models.cr_Hunts.objects.create') as cr_obj:
         id_hunt = '123'
         title = 'test title'
         start = 'test start'
         uname = 'user1'
         cr_obj = MagicMock(Title='test title', Start='test start', CreatedBy='user1')
         cr_obj.save = MagicMock(return_value=None)
         #cr_obj.save().return_value = None
         models.add_hunt_its(id_hunt, title, start, uname)
         self.assertEqual(cr_obj.Title, title) # Check that correct title is passed through
         self.assertEqual(cr_obj.Start, start) # Check that correct start point is passed through
Beispiel #2
0
def render_proc_ts(request):
    """
        :param: HttpRequest
        :rtype: HttpRequest
        Renders the "Next" page that allows the user to input his hunt title and starting location.
    """
    if request.user.is_authenticated():
        if request.method == "POST":
            global hunt_id
            uname = request.user.username
            title = str(request.POST.get('title', ''))
            start = str(request.POST.get('start', ''))
            add_hunt_its(hunt_id, title, start, uname)
            return redirect('cr_aitem')
    else:
        return redirect('cr_error')