def test_render_with_no_fragment(self): """ Verifies that a fragment view can render with no fragment. """ request = self.create_mock_request() response = ExampleFragmentView().render_standalone_response(request, None) assert response.status_code == 204
def invoke_test_view(self, method=None, arguments=None, http_accept='text/html', expected_status_code=200): """ Invokes the test view with the specified arguments (if provided). """ request = self.create_mock_request(method=method, arguments=arguments, http_accept=http_accept) response = ExampleFragmentView.as_view()(request) assert response.status_code == expected_status_code return response
#!/usr/bin/env python """ Provides a URL for testing """ from django.conf.urls import url from web_fragments.examples.views import EXAMPLE_FRAGMENT_VIEW_NAME, ExampleFragmentView urlpatterns = [ url(r'^test_fragment$', ExampleFragmentView.as_view(), name=EXAMPLE_FRAGMENT_VIEW_NAME), ]