예제 #1
0
 def test_missing_app_raises_404(self):
     request = self.factory.get('/apps/foo/')
     request.user = AnonymousUser()
     with patch('us_ignite.apps.views.get_app_for_user',
                side_effect=Http404) as get_mock:
         views.app_detail(request, 'foo')
         get_mock.assert_once_called_with('foo', request.user)
예제 #2
0
 def test_app_detail_is_valid(self, get_mock):
     request = self.factory.get('/apps/foo/')
     request.user = AnonymousUser()
     mock_app = Mock(spec=Application)()
     get_mock.return_value = mock_app
     response = views.app_detail(request, 'foo')
     eq_(sorted(response.context_data.keys()),
         sorted(['award_list', 'can_edit', 'feature_list',
                 'media_list', 'is_owner', 'member_list',
                 'object', 'url_list', 'version_list', 'hub_list'])
     )
     eq_(response.template_name, 'apps/object_detail.html')
     get_mock.assert_once_called_with('foo', request.user)