<s> from base64 import b16encode , b16decode <EOL> from django . core . urlresolvers import reverse <EOL> from django . http import HttpResponseNotAllowed <EOL> from django . test import RequestFactory <EOL> from spam . views import ReportSpamCreateView <EOL> from test_plus . test import TestCase <EOL> from test_app . models import Data <EOL> from test_app . views import DataDetailView <EOL> class TestReportSpamCreateView ( TestCase ) : <EOL> def setUp ( self ) : <EOL> self . data = Data . objects . create ( title = '<STR_LIT:test>' ) <EOL> self . factory = RequestFactory ( ) <EOL> def test_data_detail_view ( self ) : <EOL> """<STR_LIT>""" <EOL> request = self . factory . get ( '<STR_LIT>' ) <EOL> response = DataDetailView . as_view ( ) ( request , pk = self . data . pk ) <EOL> self . response_200 ( response ) <EOL> def test_slug_to_arguments ( self ) : <EOL> base_url = "<STR_LIT>" . format ( self . data . pk ) <EOL> b16_slug = b16encode ( base_url . encode ( '<STR_LIT:utf-8>' ) ) <EOL> request = self . factory . get ( '<STR_LIT>' ) <EOL> view = ReportSpamCreateView . as_view ( ) <EOL> response = view ( request , slug = b16_slug ) <EOL> self . response_200 ( response ) </s>
