示例#1
0
 def challenge_detail_anon_request_is_valid(self, mock_filter):
     request = utils.get_request(
         'get', '/challenges/gigabit/', user=utils.get_anon_mock())
     response = views.challenge_detail(request, 'gigabit')
     eq_(response.status_code, 200)
     eq_(response.template_name, 'challenges/object_detail.html')
     eq_(sorted(response.context_data.keys()), ['entry_list', 'object'])
     eq_(mock_filter.call_count, 0)
示例#2
0
 def challenge_detail_auth_user_is_valid(self, mock_get, mock_app, mock_entry):
     mock_challenge = Mock(spec=Challenge)()
     mock_get.return_value = mock_challenge
     mock_app.return_value = ['app']
     request = utils.get_request(
         'get', '/challenges/gigabit/', user=utils.get_user_mock())
     response = views.challenge_detail(request, 'gigabit')
     eq_(response.status_code, 200)
     eq_(response.template_name, 'challenges/object_detail.html')
     eq_(sorted(response.context_data.keys()), ['entry_list', 'object'])
     mock_get.assert_called_once_with(
         Challenge.active, slug__exact='gigabit', status=Challenge.PUBLISHED)
     mock_app.assert_called_once_with(
         owner=request.user, status=Application.PUBLISHED)
     mock_entry.assert_called_once_with(mock_challenge, ['app'])