<s> from django . test import SimpleTestCase <EOL> from rest_framework . routers import DefaultRouter <EOL> from rest_framework . test import APIRequestFactory <EOL> from spillway import viewsets <EOL> from spillway . renderers import GeoJSONRenderer , GeoTIFFZipRenderer <EOL> from . models import Location , RasterStore <EOL> from . test_serializers import LocationFeatureSerializer , RasterStoreSerializer <EOL> factory = APIRequestFactory ( ) <EOL> class SimpleQueryTestCase ( SimpleTestCase ) : <EOL> """<STR_LIT>""" <EOL> allow_database_queries = True <EOL> class LocationViewSet ( viewsets . GeoModelViewSet ) : <EOL> queryset = Location . objects . all ( ) <EOL> serializer_class = LocationFeatureSerializer <EOL> class RasterViewSet ( viewsets . ReadOnlyRasterModelViewSet ) : <EOL> queryset = RasterStore . objects . all ( ) <EOL> serializer_class = RasterStoreSerializer <EOL> class GeoModelViewSetTestCase ( SimpleQueryTestCase ) : <EOL> def setUp ( self ) : <EOL> self . router = DefaultRouter ( ) <EOL> self . router . register ( r'<STR_LIT>' , LocationViewSet ) <EOL> self . view = LocationViewSet . as_view ( { '<STR_LIT>' : '<STR_LIT:list>' } ) <EOL> def test_renderer ( self ) : <EOL> request = factory . get ( '<STR_LIT>' , <EOL> HTTP_ACCEPT = GeoJSONRenderer . media_type ) <EOL> response = self . view ( request ) <EOL> self . assertIsInstance ( response . accepted_renderer , GeoJSONRenderer ) <EOL> def test_register ( self ) : <EOL> self . assertGreater ( len ( self . router . urls ) , <NUM_LIT:0> ) <EOL> class RasterViewSetTestCase ( SimpleQueryTestCase ) : <EOL> def setUp ( self ) : <EOL> self . router = DefaultRouter ( ) <EOL> self . router . register ( r'<STR_LIT>' , RasterViewSet ) <EOL> self . view = RasterViewSet . as_view ( { '<STR_LIT>' : '<STR_LIT:list>' } ) <EOL> def test_renderer ( self ) : <EOL> request = factory . get ( '<STR_LIT>' , <EOL> HTTP_ACCEPT = GeoTIFFZipRenderer . media_type ) <EOL> response = self . view ( request ) <EOL> self . assertEqual ( response [ '<STR_LIT:Content-Type>' ] , <EOL> GeoTIFFZipRenderer . media_type ) <EOL> self . assertIn ( GeoTIFFZipRenderer . format , <EOL> response [ '<STR_LIT>' ] ) <EOL> def test_register ( self ) : <EOL> self . assertGreater ( len ( self . router . urls ) , <NUM_LIT:0> ) </s>
