Пример #1
0
 def test_version_renders_successfully(self, get_mock):
     app_mock = Mock(spec=Application)
     version_mock = Mock(spec=ApplicationVersion)
     version_mock.slug = '1'
     app_mock.applicationversion_set.all.return_value = [version_mock]
     get_mock.return_value = app_mock
     request = self.factory.get('/apps/gigabit/version/1/')
     request.user = AnonymousUser()
     response = views.app_version_detail(request, 'gigabit', '1')
     get_mock.assert_called_once_with('gigabit', request.user)
     app_mock.applicationversion_set.all.assert_called_once()
     eq_(sorted(response.context_data.keys()),
         ['app', 'object', 'version_list'])
     eq_(response.template_name, 'apps/object_version_detail.html')
Пример #2
0
 def test_missing_app_raises_404(self, get_mock):
     get_mock.side_effect = Http404
     request = self.factory.get('/apps/gigabit/version/1/')
     request.user = AnonymousUser()
     views.app_version_detail(request, 'gigabit', '1')
     get_mock.assert_once_called_with('foo', request.user)