<s> import json <EOL> from datetime import datetime , timedelta <EOL> from django . contrib . contenttypes . models import ContentType <EOL> from nose . tools import eq_ <EOL> from kitsune import search as constants <EOL> from kitsune . access . tests import PermissionFactory <EOL> from kitsune . forums . tests import ForumFactory , PostFactory , RestrictedForumFactory , ThreadFactory <EOL> from kitsune . products . tests import ProductFactory , TopicFactory <EOL> from kitsune . questions . tests import ( <EOL> QuestionFactory , AnswerFactory , AnswerVoteFactory , QuestionVoteFactory ) <EOL> from kitsune . search . tests . test_es import ElasticTestCase <EOL> from kitsune . sumo . tests import LocalizingClient <EOL> from kitsune . sumo . urlresolvers import reverse <EOL> from kitsune . users . tests import GroupFactory , UserFactory <EOL> from kitsune . wiki . tests import ( <EOL> DocumentFactory , ApprovedRevisionFactory , RevisionFactory , HelpfulVoteFactory ) <EOL> class AdvancedSearchTests ( ElasticTestCase ) : <EOL> client_class = LocalizingClient <EOL> def test_json_format ( self ) : <EOL> """<STR_LIT>""" <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , { <EOL> '<STR_LIT:q>' : '<STR_LIT>' , <EOL> '<STR_LIT:a>' : '<STR_LIT:1>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> } , follow = True ) <EOL> eq_ ( response . status_code , <NUM_LIT:200> ) <EOL> eq_ ( response [ '<STR_LIT:Content-Type>' ] , '<STR_LIT:application/json>' ) <EOL> def test_json_callback_validation ( self ) : <EOL> """<STR_LIT>""" <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , { <EOL> '<STR_LIT:q>' : '<STR_LIT>' , <EOL> '<STR_LIT:a>' : '<STR_LIT:1>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> } , follow = True ) <EOL> eq_ ( response . status_code , <NUM_LIT:200> ) <EOL> eq_ ( response [ '<STR_LIT:Content-Type>' ] , '<STR_LIT>' ) <EOL> def test_json_empty_query_a_1 ( self ) : <EOL> """<STR_LIT>""" <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , { <EOL> '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT:a>' : <NUM_LIT:1> , <EOL> } , follow = True ) <EOL> eq_ ( response . status_code , <NUM_LIT:200> ) <EOL> eq_ ( response [ '<STR_LIT:Content-Type>' ] , '<STR_LIT:application/json>' ) <EOL> def test_json_empty_query_a_2 ( self ) : <EOL> """<STR_LIT>""" <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , { <EOL> '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT:a>' : <NUM_LIT:2> , <EOL> } , follow = True ) <EOL> eq_ ( response . status_code , <NUM_LIT> ) <EOL> eq_ ( response [ '<STR_LIT:Content-Type>' ] , '<STR_LIT:application/json>' ) <EOL> def test_search_products ( self ) : <EOL> p = ProductFactory ( title = u'<STR_LIT>' , slug = '<STR_LIT>' ) <EOL> doc = DocumentFactory ( title = u'<STR_LIT>' , locale = '<STR_LIT>' , category = <NUM_LIT:10> , products = [ p ] ) <EOL> RevisionFactory ( document = doc , is_approved = True ) <EOL> self . refresh ( ) <EOL> response = self . client . get ( <EOL> reverse ( '<STR_LIT>' ) , <EOL> { '<STR_LIT:a>' : '<STR_LIT:1>' , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT:q>' : '<STR_LIT>' , '<STR_LIT:w>' : '<STR_LIT:1>' } ) <EOL> assert "<STR_LIT>" not in response . content <EOL> eq_ ( <NUM_LIT:200> , response . status_code ) <EOL> assert '<STR_LIT>' in response . content <EOL> def test_search_multiple_products ( self ) : <EOL> p1 = ProductFactory ( title = u'<STR_LIT>' , slug = '<STR_LIT>' , display_order = <NUM_LIT:1> ) <EOL> p2 = ProductFactory ( title = u'<STR_LIT>' , slug = '<STR_LIT>' , display_order = <NUM_LIT:2> ) <EOL> doc1 = DocumentFactory ( title = u'<STR_LIT>' , locale = '<STR_LIT>' , category = <NUM_LIT:10> , products = [ p1 , p2 ] ) <EOL> RevisionFactory ( document = doc1 , is_approved = True ) <EOL> self . refresh ( ) <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , { <EOL> '<STR_LIT:a>' : '<STR_LIT:1>' , <EOL> '<STR_LIT>' : [ '<STR_LIT>' , '<STR_LIT>' ] , <EOL> '<STR_LIT:q>' : '<STR_LIT>' , <EOL> '<STR_LIT:w>' : '<STR_LIT:1>' , <EOL> } ) <EOL> eq_ ( <NUM_LIT:200> , response . status_code ) <EOL> assert "<STR_LIT>" not in response . content <EOL> assert '<STR_LIT>' in response . content <EOL> def test_wiki_no_query ( self ) : <EOL> """<STR_LIT>""" <EOL> doc = DocumentFactory ( locale = u'<STR_LIT>' , category = <NUM_LIT:10> ) <EOL> doc . tags . add ( u'<STR_LIT>' ) <EOL> RevisionFactory ( document = doc , is_approved = True ) <EOL> self . refresh ( ) <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , { <EOL> '<STR_LIT:q>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT:w>' : '<STR_LIT:1>' , '<STR_LIT:a>' : '<STR_LIT:1>' , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } ) <EOL> eq_ ( <NUM_LIT:200> , response . status_code ) <EOL> content = json . loads ( response . content ) <EOL> eq_ ( content [ '<STR_LIT>' ] , <NUM_LIT:1> ) <EOL> def test_questions_sortby ( self ) : <EOL> """<STR_LIT>""" <EOL> QuestionFactory ( title = u'<STR_LIT>' ) <EOL> self . refresh ( ) <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , { <EOL> '<STR_LIT:q>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT:w>' : '<STR_LIT:2>' , '<STR_LIT:a>' : '<STR_LIT:1>' , '<STR_LIT>' : '<STR_LIT:3>' , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } ) <EOL> eq_ ( <NUM_LIT:200> , response . status_code ) <EOL> content = json . loads ( response . content ) <EOL> eq_ ( content [ '<STR_LIT>' ] , <NUM_LIT:1> ) <EOL> def test_sortby_documents_helpful ( self ) : <EOL> """<STR_LIT>""" <EOL> r1 = RevisionFactory ( is_approved = True ) <EOL> r2 = RevisionFactory ( is_approved = True ) <EOL> HelpfulVoteFactory ( revision = r2 , helpful = True ) <EOL> self . setup_indexes ( ) <EOL> self . reindex_and_refresh ( ) <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , { <EOL> '<STR_LIT:w>' : '<STR_LIT:1>' , '<STR_LIT:a>' : '<STR_LIT:1>' , '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } ) <EOL> eq_ ( <NUM_LIT:200> , response . status_code ) <EOL> content = json . loads ( response . content ) <EOL> eq_ ( r2 . document . title , content [ '<STR_LIT>' ] [ <NUM_LIT:0> ] [ '<STR_LIT:title>' ] ) <EOL> HelpfulVoteFactory ( revision = r1 , helpful = True ) <EOL> HelpfulVoteFactory ( revision = r1 , helpful = True ) <EOL> self . setup_indexes ( ) <EOL> self . reindex_and_refresh ( ) <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , { <EOL> '<STR_LIT:w>' : '<STR_LIT:1>' , '<STR_LIT:a>' : '<STR_LIT:1>' , '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' } ) <EOL> eq_ ( <NUM_LIT:200> , response . status_code ) <EOL> content = json . loads ( response . content ) <EOL> eq_ ( r1 . document . title , content [ '<STR_LIT>' ] [ <NUM_LIT:0> ] [ '<STR_LIT:title>' ] ) <EOL> def test_questions_num_votes ( self ) : <EOL> """<STR_LIT>""" <EOL> q = QuestionFactory ( title = u'<STR_LIT>' ) <EOL> QuestionVoteFactory ( question = q ) <EOL> QuestionVoteFactory ( question = q ) <EOL> self . refresh ( ) <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , { <EOL> '<STR_LIT:q>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT:w>' : '<STR_LIT:2>' , '<STR_LIT:a>' : '<STR_LIT:1>' , <EOL> '<STR_LIT>' : <NUM_LIT:2> , '<STR_LIT>' : <NUM_LIT:5> , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } ) <EOL> eq_ ( <NUM_LIT:200> , response . status_code ) <EOL> content = json . loads ( response . content ) <EOL> eq_ ( content [ '<STR_LIT>' ] , <NUM_LIT:0> ) <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , { <EOL> '<STR_LIT:q>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT:w>' : '<STR_LIT:2>' , '<STR_LIT:a>' : '<STR_LIT:1>' , <EOL> '<STR_LIT>' : <NUM_LIT:1> , '<STR_LIT>' : <NUM_LIT:1> , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } ) <EOL> eq_ ( <NUM_LIT:200> , response . status_code ) <EOL> content = json . loads ( response . content ) <EOL> eq_ ( content [ '<STR_LIT>' ] , <NUM_LIT:0> ) <EOL> def test_num_votes_none ( self ) : <EOL> """<STR_LIT>""" <EOL> q = QuestionFactory ( ) <EOL> QuestionVoteFactory ( question = q ) <EOL> self . refresh ( ) <EOL> qs = { '<STR_LIT:q>' : '<STR_LIT>' , '<STR_LIT:w>' : <NUM_LIT:2> , '<STR_LIT:a>' : <NUM_LIT:1> , '<STR_LIT>' : <NUM_LIT:2> , '<STR_LIT>' : '<STR_LIT>' } <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , qs ) <EOL> eq_ ( <NUM_LIT:200> , response . status_code ) <EOL> def test_forums_search ( self ) : <EOL> """<STR_LIT>""" <EOL> thread1 = ThreadFactory ( title = u'<STR_LIT>' ) <EOL> PostFactory ( thread = thread1 ) <EOL> self . refresh ( ) <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , { <EOL> '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT:0>' , '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT:0>' , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT:0>' , <EOL> '<STR_LIT:a>' : '<STR_LIT:1>' , '<STR_LIT:w>' : '<STR_LIT:4>' , '<STR_LIT:q>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } ) <EOL> eq_ ( <NUM_LIT:200> , response . status_code ) <EOL> content = json . loads ( response . content ) <EOL> eq_ ( content [ '<STR_LIT>' ] , <NUM_LIT:1> ) <EOL> def test_forums_search_authorized_forums ( self ) : <EOL> """<STR_LIT>""" <EOL> forum1 = ForumFactory ( name = u'<STR_LIT>' ) <EOL> thread1 = ThreadFactory ( forum = forum1 ) <EOL> PostFactory ( thread = thread1 , content = u'<STR_LIT>' ) <EOL> forum2 = RestrictedForumFactory ( name = u'<STR_LIT>' ) <EOL> thread2 = ThreadFactory ( forum = forum2 ) <EOL> PostFactory ( thread = thread2 , content = u'<STR_LIT>' ) <EOL> self . refresh ( ) <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT:0>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT:0>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT:0>' , <EOL> '<STR_LIT:a>' : '<STR_LIT:1>' , <EOL> '<STR_LIT:w>' : '<STR_LIT:4>' , <EOL> '<STR_LIT:q>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } ) <EOL> eq_ ( <NUM_LIT:200> , response . status_code ) <EOL> content = json . loads ( response . content ) <EOL> eq_ ( content [ '<STR_LIT>' ] , <NUM_LIT:1> ) <EOL> u = UserFactory ( ) <EOL> g = GroupFactory ( ) <EOL> g . user_set . add ( u ) <EOL> ct = ContentType . objects . get_for_model ( forum2 ) <EOL> PermissionFactory ( <EOL> codename = '<STR_LIT>' , <EOL> content_type = ct , <EOL> object_id = forum2 . id , <EOL> group = g ) <EOL> self . client . login ( username = u . username , password = '<STR_LIT>' ) <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT:0>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT:0>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT:0>' , <EOL> '<STR_LIT:a>' : '<STR_LIT:1>' , <EOL> '<STR_LIT:w>' : '<STR_LIT:4>' , <EOL> '<STR_LIT:q>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } ) <EOL> eq_ ( <NUM_LIT:200> , response . status_code ) <EOL> content = json . loads ( response . content ) <EOL> eq_ ( content [ '<STR_LIT>' ] , <NUM_LIT:2> ) <EOL> def test_forums_search_authorized_forums_specifying_forums ( self ) : <EOL> """<STR_LIT>""" <EOL> forum1 = ForumFactory ( name = u'<STR_LIT>' ) <EOL> thread1 = ThreadFactory ( forum = forum1 ) <EOL> PostFactory ( thread = thread1 , content = u'<STR_LIT>' ) <EOL> forum2 = RestrictedForumFactory ( name = u'<STR_LIT>' ) <EOL> thread2 = ThreadFactory ( forum = forum2 ) <EOL> PostFactory ( thread = thread2 , content = u'<STR_LIT>' ) <EOL> self . refresh ( ) <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT:0>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT:0>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT:0>' , <EOL> '<STR_LIT>' : [ forum1 . id , forum2 . id ] , <EOL> '<STR_LIT:a>' : '<STR_LIT:1>' , <EOL> '<STR_LIT:w>' : '<STR_LIT:4>' , <EOL> '<STR_LIT:q>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } ) <EOL> eq_ ( <NUM_LIT:200> , response . status_code ) <EOL> content = json . loads ( response . content ) <EOL> eq_ ( content [ '<STR_LIT>' ] , <NUM_LIT:1> ) <EOL> u = UserFactory ( ) <EOL> g = GroupFactory ( ) <EOL> g . user_set . add ( u ) <EOL> ct = ContentType . objects . get_for_model ( forum2 ) <EOL> PermissionFactory ( <EOL> codename = '<STR_LIT>' , <EOL> content_type = ct , <EOL> object_id = forum2 . id , <EOL> group = g ) <EOL> self . client . login ( username = u . username , password = '<STR_LIT>' ) <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT:0>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT:0>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT:0>' , <EOL> '<STR_LIT>' : [ forum1 . id , forum2 . id ] , <EOL> '<STR_LIT:a>' : '<STR_LIT:1>' , <EOL> '<STR_LIT:w>' : '<STR_LIT:4>' , <EOL> '<STR_LIT:q>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } ) <EOL> eq_ ( <NUM_LIT:200> , response . status_code ) <EOL> content = json . loads ( response . content ) <EOL> eq_ ( content [ '<STR_LIT>' ] , <NUM_LIT:2> ) <EOL> def test_forums_thread_created ( self ) : <EOL> """<STR_LIT>""" <EOL> post_created_ds = datetime ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:12> , <NUM_LIT> ) <EOL> thread1 = ThreadFactory ( title = u'<STR_LIT>' , created = post_created_ds ) <EOL> PostFactory ( thread = thread1 , created = ( post_created_ds + timedelta ( hours = <NUM_LIT:1> ) ) ) <EOL> self . refresh ( ) <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , { <EOL> '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT:2>' , '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT:0>' , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT:0>' , <EOL> '<STR_LIT:a>' : '<STR_LIT:1>' , '<STR_LIT:w>' : '<STR_LIT:4>' , '<STR_LIT:q>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } ) <EOL> eq_ ( <NUM_LIT:200> , response . status_code ) <EOL> content = json . loads ( response . content ) <EOL> eq_ ( content [ '<STR_LIT>' ] , <NUM_LIT:0> ) <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , { <EOL> '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT:2>' , '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT:0>' , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT:0>' , <EOL> '<STR_LIT:a>' : '<STR_LIT:1>' , '<STR_LIT:w>' : '<STR_LIT:4>' , '<STR_LIT:q>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } ) <EOL> eq_ ( <NUM_LIT:200> , response . status_code ) <EOL> content = json . loads ( response . content ) <EOL> eq_ ( content [ '<STR_LIT>' ] , <NUM_LIT:1> ) <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , { <EOL> '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT:1>' , '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT:0>' , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT:0>' , <EOL> '<STR_LIT:a>' : '<STR_LIT:1>' , '<STR_LIT:w>' : '<STR_LIT:4>' , '<STR_LIT:q>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } ) <EOL> eq_ ( <NUM_LIT:200> , response . status_code ) <EOL> content = json . loads ( response . content ) <EOL> eq_ ( content [ '<STR_LIT>' ] , <NUM_LIT:1> ) <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , { <EOL> '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT:1>' , '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT:0>' , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT:0>' , <EOL> '<STR_LIT:a>' : '<STR_LIT:1>' , '<STR_LIT:w>' : '<STR_LIT:4>' , '<STR_LIT:q>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } ) <EOL> eq_ ( <NUM_LIT:200> , response . status_code ) <EOL> content = json . loads ( response . content ) <EOL> eq_ ( content [ '<STR_LIT>' ] , <NUM_LIT:0> ) <EOL> def test_multi_word_tag_search ( self ) : <EOL> """<STR_LIT>""" <EOL> ques = QuestionFactory ( title = u'<STR_LIT>' ) <EOL> ques . tags . add ( u'<STR_LIT>' ) <EOL> self . refresh ( ) <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , { <EOL> '<STR_LIT:q>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT:w>' : '<STR_LIT:2>' , '<STR_LIT:a>' : '<STR_LIT:1>' , <EOL> '<STR_LIT>' : '<STR_LIT:0>' , '<STR_LIT>' : '<STR_LIT>' <EOL> } ) <EOL> eq_ ( <NUM_LIT:200> , response . status_code ) <EOL> content = json . loads ( response . content ) <EOL> eq_ ( content [ '<STR_LIT>' ] , <NUM_LIT:1> ) <EOL> def test_category_invalid ( self ) : <EOL> """<STR_LIT>""" <EOL> ques = QuestionFactory ( title = u'<STR_LIT>' ) <EOL> ques . tags . add ( u'<STR_LIT>' ) <EOL> ans = AnswerFactory ( question = ques ) <EOL> AnswerVoteFactory ( answer = ans , helpful = True ) <EOL> d1 = DocumentFactory ( <EOL> title = u'<STR_LIT>' , <EOL> locale = u'<STR_LIT>' , <EOL> category = <NUM_LIT:10> , <EOL> is_archived = False , <EOL> tags = [ u'<STR_LIT>' ] ) <EOL> ApprovedRevisionFactory ( document = d1 ) <EOL> self . refresh ( ) <EOL> qs = { '<STR_LIT:a>' : <NUM_LIT:1> , '<STR_LIT:w>' : <NUM_LIT:3> , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' } <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , qs ) <EOL> eq_ ( <NUM_LIT:2> , json . loads ( response . content ) [ '<STR_LIT>' ] ) <EOL> def test_created ( self ) : <EOL> """<STR_LIT>""" <EOL> created_ds = datetime ( <NUM_LIT> , <NUM_LIT:6> , <NUM_LIT> , <NUM_LIT:12> , <NUM_LIT> ) <EOL> q1 = QuestionFactory ( title = u'<STR_LIT>' , created = created_ds ) <EOL> q1 . tags . add ( u'<STR_LIT>' ) <EOL> ans = AnswerFactory ( question = q1 ) <EOL> AnswerVoteFactory ( answer = ans , helpful = True ) <EOL> q2 = QuestionFactory ( <EOL> title = u'<STR_LIT>' , <EOL> created = ( created_ds + timedelta ( days = <NUM_LIT:2> ) ) , <EOL> tags = [ u'<STR_LIT>' ] ) <EOL> ans = AnswerFactory ( question = q2 ) <EOL> AnswerVoteFactory ( answer = ans , helpful = True ) <EOL> self . refresh ( ) <EOL> qs = { '<STR_LIT:a>' : <NUM_LIT:1> , '<STR_LIT:w>' : <NUM_LIT:2> , '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : <NUM_LIT:2> , '<STR_LIT>' : '<STR_LIT>' } <EOL> qs [ '<STR_LIT>' ] = constants . INTERVAL_BEFORE <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , qs ) <EOL> results = json . loads ( response . content ) [ '<STR_LIT>' ] <EOL> eq_ ( [ q1 . get_absolute_url ( ) ] , [ r [ '<STR_LIT:url>' ] for r in results ] ) <EOL> qs [ '<STR_LIT>' ] = constants . INTERVAL_AFTER <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , qs ) <EOL> results = json . loads ( response . content ) [ '<STR_LIT>' ] <EOL> eq_ ( [ q2 . get_absolute_url ( ) ] , [ r [ '<STR_LIT:url>' ] for r in results ] ) <EOL> def test_sortby_invalid ( self ) : <EOL> """<STR_LIT>""" <EOL> qs = { '<STR_LIT:a>' : <NUM_LIT:1> , '<STR_LIT:w>' : <NUM_LIT:4> , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' } <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , qs ) <EOL> eq_ ( <NUM_LIT:200> , response . status_code ) <EOL> def test_created_date_invalid ( self ) : <EOL> """<STR_LIT>""" <EOL> thread1 = ThreadFactory ( ) <EOL> PostFactory ( thread = thread1 ) <EOL> self . refresh ( ) <EOL> qs = { '<STR_LIT:a>' : <NUM_LIT:1> , '<STR_LIT:w>' : <NUM_LIT:4> , '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : constants . INTERVAL_AFTER , <EOL> '<STR_LIT>' : '<STR_LIT>' } <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , qs ) <EOL> eq_ ( <NUM_LIT:1> , json . loads ( response . content ) [ '<STR_LIT>' ] ) <EOL> def test_created_date_nonexistent ( self ) : <EOL> """<STR_LIT>""" <EOL> qs = { '<STR_LIT:a>' : <NUM_LIT:1> , '<STR_LIT:w>' : <NUM_LIT:2> , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : <NUM_LIT:1> } <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , qs ) <EOL> eq_ ( <NUM_LIT:200> , response . status_code ) <EOL> def test_updated_invalid ( self ) : <EOL> """<STR_LIT>""" <EOL> thread1 = ThreadFactory ( ) <EOL> PostFactory ( thread = thread1 ) <EOL> self . refresh ( ) <EOL> qs = { '<STR_LIT:a>' : <NUM_LIT:1> , '<STR_LIT:w>' : <NUM_LIT:4> , '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : <NUM_LIT:1> , '<STR_LIT>' : '<STR_LIT>' } <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , qs ) <EOL> eq_ ( <NUM_LIT:1> , json . loads ( response . content ) [ '<STR_LIT>' ] ) <EOL> def test_updated_nonexistent ( self ) : <EOL> """<STR_LIT>""" <EOL> thread1 = ThreadFactory ( ) <EOL> PostFactory ( thread = thread1 ) <EOL> self . refresh ( ) <EOL> qs = { '<STR_LIT:a>' : <NUM_LIT:1> , '<STR_LIT:w>' : <NUM_LIT:2> , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : <NUM_LIT:1> } <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , qs ) <EOL> eq_ ( response . status_code , <NUM_LIT:200> ) <EOL> def test_asked_by ( self ) : <EOL> """<STR_LIT>""" <EOL> author_vals = ( <EOL> ( '<STR_LIT>' , <NUM_LIT:0> ) , <EOL> ( '<STR_LIT>' , <NUM_LIT:2> ) , <EOL> ( '<STR_LIT>' , <NUM_LIT:2> ) , <EOL> ) <EOL> for name , number in author_vals : <EOL> u = UserFactory ( username = name ) <EOL> for i in range ( number ) : <EOL> ques = QuestionFactory ( title = u'<STR_LIT>' , creator = u ) <EOL> ques . tags . add ( u'<STR_LIT>' ) <EOL> ans = AnswerFactory ( question = ques ) <EOL> AnswerVoteFactory ( answer = ans , helpful = True ) <EOL> self . refresh ( ) <EOL> qs = { '<STR_LIT:a>' : <NUM_LIT:1> , '<STR_LIT:w>' : <NUM_LIT:2> , '<STR_LIT>' : '<STR_LIT>' } <EOL> for author , total in author_vals : <EOL> qs . update ( { '<STR_LIT>' : author } ) <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , qs ) <EOL> eq_ ( total , json . loads ( response . content ) [ '<STR_LIT>' ] ) <EOL> def test_question_topics ( self ) : <EOL> """<STR_LIT>""" <EOL> p = ProductFactory ( ) <EOL> t1 = TopicFactory ( slug = '<STR_LIT>' , product = p ) <EOL> t2 = TopicFactory ( slug = '<STR_LIT>' , product = p ) <EOL> t3 = TopicFactory ( slug = '<STR_LIT>' , product = p ) <EOL> QuestionFactory ( topic = t2 ) <EOL> QuestionFactory ( topic = t2 ) <EOL> QuestionFactory ( topic = t3 ) <EOL> self . refresh ( ) <EOL> topic_vals = ( <EOL> ( t1 . slug , <NUM_LIT:0> ) , <EOL> ( t2 . slug , <NUM_LIT:2> ) , <EOL> ( t3 . slug , <NUM_LIT:1> ) , <EOL> ) <EOL> qs = { '<STR_LIT:a>' : <NUM_LIT:1> , '<STR_LIT:w>' : <NUM_LIT:2> , '<STR_LIT>' : '<STR_LIT>' } <EOL> for topics , number in topic_vals : <EOL> qs . update ( { '<STR_LIT>' : topics } ) <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , qs ) <EOL> eq_ ( number , json . loads ( response . content ) [ '<STR_LIT>' ] ) <EOL> def test_wiki_topics ( self ) : <EOL> """<STR_LIT>""" <EOL> t1 = TopicFactory ( slug = '<STR_LIT>' ) <EOL> t2 = TopicFactory ( slug = '<STR_LIT>' ) <EOL> t3 = TopicFactory ( slug = '<STR_LIT>' ) <EOL> doc = DocumentFactory ( locale = u'<STR_LIT>' , category = <NUM_LIT:10> ) <EOL> doc . topics . add ( t2 ) <EOL> RevisionFactory ( document = doc , is_approved = True ) <EOL> doc = DocumentFactory ( locale = u'<STR_LIT>' , category = <NUM_LIT:10> ) <EOL> doc . topics . add ( t2 ) <EOL> doc . topics . add ( t3 ) <EOL> RevisionFactory ( document = doc , is_approved = True ) <EOL> self . refresh ( ) <EOL> topic_vals = ( <EOL> ( t1 . slug , <NUM_LIT:0> ) , <EOL> ( t2 . slug , <NUM_LIT:2> ) , <EOL> ( t3 . slug , <NUM_LIT:1> ) , <EOL> ( [ t2 . slug , t3 . slug ] , <NUM_LIT:1> ) , <EOL> ) <EOL> qs = { '<STR_LIT:a>' : <NUM_LIT:1> , '<STR_LIT:w>' : <NUM_LIT:1> , '<STR_LIT>' : '<STR_LIT>' } <EOL> for topics , number in topic_vals : <EOL> qs . update ( { '<STR_LIT>' : topics } ) <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , qs ) <EOL> eq_ ( number , json . loads ( response . content ) [ '<STR_LIT>' ] ) <EOL> def test_wiki_topics_inherit ( self ) : <EOL> """<STR_LIT>""" <EOL> doc = DocumentFactory ( locale = u'<STR_LIT>' , category = <NUM_LIT:10> ) <EOL> doc . topics . add ( TopicFactory ( slug = '<STR_LIT>' ) ) <EOL> RevisionFactory ( document = doc , is_approved = True ) <EOL> translated = DocumentFactory ( locale = u'<STR_LIT>' , parent = doc , category = <NUM_LIT:10> ) <EOL> RevisionFactory ( document = translated , is_approved = True ) <EOL> self . refresh ( ) <EOL> qs = { '<STR_LIT:a>' : <NUM_LIT:1> , '<STR_LIT:w>' : <NUM_LIT:1> , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' } <EOL> response = self . client . get ( reverse ( '<STR_LIT>' , locale = '<STR_LIT>' ) , qs ) <EOL> eq_ ( <NUM_LIT:1> , json . loads ( response . content ) [ '<STR_LIT>' ] ) <EOL> def test_question_products ( self ) : <EOL> """<STR_LIT>""" <EOL> p1 = ProductFactory ( slug = '<STR_LIT>' ) <EOL> p2 = ProductFactory ( slug = '<STR_LIT>' ) <EOL> p3 = ProductFactory ( slug = '<STR_LIT>' ) <EOL> QuestionFactory ( product = p2 ) <EOL> QuestionFactory ( product = p2 ) <EOL> QuestionFactory ( product = p3 ) <EOL> self . refresh ( ) <EOL> product_vals = ( <EOL> ( p1 . slug , <NUM_LIT:0> ) , <EOL> ( p2 . slug , <NUM_LIT:2> ) , <EOL> ( p3 . slug , <NUM_LIT:1> ) , <EOL> ) <EOL> qs = { '<STR_LIT:a>' : <NUM_LIT:1> , '<STR_LIT:w>' : <NUM_LIT:2> , '<STR_LIT>' : '<STR_LIT>' } <EOL> for products , number in product_vals : <EOL> qs . update ( { '<STR_LIT>' : products } ) <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , qs ) <EOL> eq_ ( number , json . loads ( response . content ) [ '<STR_LIT>' ] ) <EOL> def test_wiki_products ( self ) : <EOL> """<STR_LIT>""" <EOL> prod_vals = ( <EOL> ( ProductFactory ( slug = '<STR_LIT>' ) , <NUM_LIT:0> ) , <EOL> ( ProductFactory ( slug = '<STR_LIT>' ) , <NUM_LIT:1> ) , <EOL> ( ProductFactory ( slug = '<STR_LIT>' ) , <NUM_LIT:2> ) , <EOL> ) <EOL> for prod , total in prod_vals : <EOL> for i in range ( total ) : <EOL> doc = DocumentFactory ( locale = u'<STR_LIT>' , category = <NUM_LIT:10> ) <EOL> doc . products . add ( prod ) <EOL> RevisionFactory ( document = doc , is_approved = True ) <EOL> self . refresh ( ) <EOL> qs = { '<STR_LIT:a>' : <NUM_LIT:1> , '<STR_LIT:w>' : <NUM_LIT:1> , '<STR_LIT>' : '<STR_LIT>' } <EOL> for prod , total in prod_vals : <EOL> qs . update ( { '<STR_LIT>' : prod . slug } ) <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , qs ) <EOL> eq_ ( total , json . loads ( response . content ) [ '<STR_LIT>' ] ) <EOL> def test_wiki_products_inherit ( self ) : <EOL> """<STR_LIT>""" <EOL> doc = DocumentFactory ( locale = u'<STR_LIT>' , category = <NUM_LIT:10> ) <EOL> p = ProductFactory ( title = u'<STR_LIT>' , slug = u'<STR_LIT>' ) <EOL> doc . products . add ( p ) <EOL> RevisionFactory ( document = doc , is_approved = True ) <EOL> translated = DocumentFactory ( locale = u'<STR_LIT>' , parent = doc , category = <NUM_LIT:10> ) <EOL> RevisionFactory ( document = translated , is_approved = True ) <EOL> self . refresh ( ) <EOL> qs = { '<STR_LIT:a>' : <NUM_LIT:1> , '<STR_LIT:w>' : <NUM_LIT:1> , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : p . slug } <EOL> response = self . client . get ( reverse ( '<STR_LIT>' , locale = '<STR_LIT>' ) , qs ) <EOL> eq_ ( <NUM_LIT:1> , json . loads ( response . content ) [ '<STR_LIT>' ] ) <EOL> def test_discussion_filter_author ( self ) : <EOL> """<STR_LIT>""" <EOL> author_vals = ( <EOL> ( '<STR_LIT>' , <NUM_LIT:0> ) , <EOL> ( '<STR_LIT>' , <NUM_LIT:1> ) , <EOL> ( '<STR_LIT>' , <NUM_LIT:4> ) , <EOL> ) <EOL> for name , number in author_vals : <EOL> u = UserFactory ( username = name ) <EOL> for i in range ( number ) : <EOL> thread1 = ThreadFactory ( title = u'<STR_LIT>' ) <EOL> PostFactory ( thread = thread1 , author = u ) <EOL> self . refresh ( ) <EOL> qs = { '<STR_LIT:a>' : <NUM_LIT:1> , '<STR_LIT:w>' : <NUM_LIT:4> , '<STR_LIT>' : '<STR_LIT>' } <EOL> for author , total in author_vals : <EOL> qs . update ( { '<STR_LIT>' : author } ) <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , qs ) <EOL> eq_ ( total , json . loads ( response . content ) [ '<STR_LIT>' ] ) <EOL> def test_discussion_filter_sticky ( self ) : <EOL> """<STR_LIT>""" <EOL> thread1 = ThreadFactory ( title = u'<STR_LIT>' , is_locked = True , is_sticky = True ) <EOL> PostFactory ( thread = thread1 ) <EOL> self . refresh ( ) <EOL> qs = { '<STR_LIT:a>' : <NUM_LIT:1> , '<STR_LIT:w>' : <NUM_LIT:4> , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : <NUM_LIT:1> , '<STR_LIT>' : <NUM_LIT:1> } <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , qs ) <EOL> results = json . loads ( response . content ) [ '<STR_LIT>' ] <EOL> eq_ ( len ( results ) , <NUM_LIT:1> ) <EOL> def test_discussion_filter_locked ( self ) : <EOL> """<STR_LIT>""" <EOL> thread1 = ThreadFactory ( title = u'<STR_LIT>' , is_locked = True ) <EOL> PostFactory ( thread = thread1 ) <EOL> self . refresh ( ) <EOL> qs = { '<STR_LIT:a>' : <NUM_LIT:1> , '<STR_LIT:w>' : <NUM_LIT:4> , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : <NUM_LIT:2> } <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , qs ) <EOL> results = json . loads ( response . content ) [ '<STR_LIT>' ] <EOL> eq_ ( len ( results ) , <NUM_LIT:1> ) <EOL> def test_discussion_filter_sticky_locked ( self ) : <EOL> """<STR_LIT>""" <EOL> thread1 = ThreadFactory ( title = u'<STR_LIT>' , is_locked = True , is_sticky = True ) <EOL> PostFactory ( thread = thread1 ) <EOL> self . refresh ( ) <EOL> qs = { '<STR_LIT:a>' : <NUM_LIT:1> , '<STR_LIT:w>' : <NUM_LIT:4> , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : ( <NUM_LIT:1> , <NUM_LIT:2> ) } <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , qs ) <EOL> result = json . loads ( response . content ) [ '<STR_LIT>' ] [ <NUM_LIT:0> ] <EOL> eq_ ( thread1 . get_absolute_url ( ) , result [ '<STR_LIT:url>' ] ) <EOL> def test_forums_filter_updated ( self ) : <EOL> """<STR_LIT>""" <EOL> post_updated_ds = datetime ( <NUM_LIT> , <NUM_LIT:5> , <NUM_LIT:3> , <NUM_LIT:12> , <NUM_LIT> ) <EOL> thread1 = ThreadFactory ( title = u'<STR_LIT>' ) <EOL> PostFactory ( thread = thread1 , created = post_updated_ds ) <EOL> thread2 = ThreadFactory ( title = u'<STR_LIT>' ) <EOL> PostFactory ( thread = thread2 , created = ( post_updated_ds + timedelta ( days = <NUM_LIT:2> ) ) ) <EOL> self . refresh ( ) <EOL> qs = { '<STR_LIT:a>' : <NUM_LIT:1> , '<STR_LIT:w>' : <NUM_LIT:4> , '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : <NUM_LIT:1> , '<STR_LIT>' : '<STR_LIT>' } <EOL> qs [ '<STR_LIT>' ] = constants . INTERVAL_BEFORE <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , qs ) <EOL> results = json . loads ( response . content ) [ '<STR_LIT>' ] <EOL> eq_ ( [ thread1 . get_absolute_url ( ) ] , [ r [ '<STR_LIT:url>' ] for r in results ] ) <EOL> qs [ '<STR_LIT>' ] = constants . INTERVAL_AFTER <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , qs ) <EOL> results = json . loads ( response . content ) [ '<STR_LIT>' ] <EOL> eq_ ( [ thread2 . get_absolute_url ( ) ] , [ r [ '<STR_LIT:url>' ] for r in results ] ) <EOL> def test_archived ( self ) : <EOL> """<STR_LIT>""" <EOL> doc = DocumentFactory ( title = u'<STR_LIT>' , locale = u'<STR_LIT>' , is_archived = True ) <EOL> ApprovedRevisionFactory ( document = doc , summary = u'<STR_LIT>' , is_approved = True ) <EOL> self . refresh ( ) <EOL> qs = { '<STR_LIT:q>' : '<STR_LIT>' , '<STR_LIT:a>' : <NUM_LIT:1> , '<STR_LIT:w>' : <NUM_LIT:1> , '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' } <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , qs ) <EOL> results = json . loads ( response . content ) [ '<STR_LIT>' ] <EOL> eq_ ( <NUM_LIT:1> , len ( results ) ) <EOL> qs = { '<STR_LIT:q>' : '<STR_LIT>' , '<STR_LIT:a>' : <NUM_LIT:0> , '<STR_LIT:w>' : <NUM_LIT:1> , '<STR_LIT>' : '<STR_LIT>' } <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , qs ) <EOL> results = json . loads ( response . content ) [ '<STR_LIT>' ] <EOL> eq_ ( <NUM_LIT:0> , len ( results ) ) <EOL> def test_discussion_filter_forum ( self ) : <EOL> """<STR_LIT>""" <EOL> forum1 = ForumFactory ( name = u'<STR_LIT>' ) <EOL> thread1 = ThreadFactory ( forum = forum1 , title = u'<STR_LIT>' ) <EOL> PostFactory ( thread = thread1 ) <EOL> forum2 = ForumFactory ( name = u'<STR_LIT>' ) <EOL> thread2 = ThreadFactory ( forum = forum2 , title = u'<STR_LIT>' ) <EOL> PostFactory ( thread = thread2 ) <EOL> self . refresh ( ) <EOL> qs = { '<STR_LIT:a>' : <NUM_LIT:1> , '<STR_LIT:w>' : <NUM_LIT:4> , '<STR_LIT>' : '<STR_LIT>' } <EOL> for forum_id in ( forum1 . id , forum2 . id ) : <EOL> qs [ '<STR_LIT>' ] = int ( forum_id ) <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , qs ) <EOL> eq_ ( json . loads ( response . content ) [ '<STR_LIT>' ] , <NUM_LIT:1> ) <EOL> def test_discussion_forum_with_restricted_forums ( self ) : <EOL> """<STR_LIT>""" <EOL> forum1 = ForumFactory ( name = u'<STR_LIT>' ) <EOL> thread1 = ThreadFactory ( forum = forum1 , title = u'<STR_LIT>' ) <EOL> PostFactory ( thread = thread1 ) <EOL> forum2 = RestrictedForumFactory ( name = u'<STR_LIT>' ) <EOL> thread2 = ThreadFactory ( forum = forum2 , title = u'<STR_LIT>' ) <EOL> PostFactory ( thread = thread2 ) <EOL> self . refresh ( ) <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , { '<STR_LIT:a>' : '<STR_LIT:2>' } ) <EOL> eq_ ( <NUM_LIT:200> , response . status_code ) <EOL> assert '<STR_LIT>' in response . content <EOL> assert '<STR_LIT>' not in response . content <EOL> u = UserFactory ( ) <EOL> g = GroupFactory ( ) <EOL> g . user_set . add ( u ) <EOL> ct = ContentType . objects . get_for_model ( forum2 ) <EOL> PermissionFactory ( <EOL> codename = '<STR_LIT>' , <EOL> content_type = ct , <EOL> object_id = forum2 . id , <EOL> group = g ) <EOL> self . client . login ( username = u . username , password = '<STR_LIT>' ) <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) , { '<STR_LIT:a>' : '<STR_LIT:2>' } ) <EOL> eq_ ( <NUM_LIT:200> , response . status_code ) <EOL> assert '<STR_LIT>' in response . content <EOL> assert '<STR_LIT>' in response . content </s>
