<s> import datetime <EOL> import json as simplejson <EOL> from dateutil . relativedelta import relativedelta <EOL> from django . test import TestCase <EOL> from django . utils . dateformat import format as format_ <EOL> from intranet . org . models import Event <EOL> class WWWAjaxTestCase ( TestCase ) : <EOL> """<STR_LIT>""" <EOL> fixtures = [ '<STR_LIT>' ] <EOL> def test_ajax_index_events_now ( self ) : <EOL> """<STR_LIT>""" <EOL> resp = self . client . get ( '<STR_LIT>' , follow = True ) <EOL> events_dict = simplejson . loads ( resp . content ) <EOL> self . assertEqual ( resp . status_code , <NUM_LIT:200> ) <EOL> today = datetime . date . today ( ) <EOL> today_date = format_ ( today , '<STR_LIT>' ) . capitalize ( ) <EOL> today_short_date = format_ ( today , '<STR_LIT>' ) <EOL> self . assertIn ( '<STR_LIT>' , events_dict ) <EOL> self . assertIn ( '<STR_LIT>' , events_dict ) <EOL> self . assertIn ( '<STR_LIT>' , events_dict ) <EOL> for i in range ( <NUM_LIT:7> ) : <EOL> events_by_day = events_dict [ '<STR_LIT>' ] [ str ( i ) ] <EOL> self . assertIn ( '<STR_LIT:date>' , events_by_day ) <EOL> self . assertIn ( type ( events_by_day [ '<STR_LIT:date>' ] ) , [ unicode , str ] ) <EOL> self . assertIn ( '<STR_LIT>' , events_by_day ) <EOL> self . assertEqual ( list , type ( events_by_day [ '<STR_LIT>' ] ) ) <EOL> self . assertIn ( '<STR_LIT>' , events_by_day ) <EOL> self . assertEqual ( bool , type ( events_by_day [ '<STR_LIT>' ] ) ) <EOL> self . assertIn ( '<STR_LIT>' , events_by_day ) <EOL> self . assertIn ( type ( events_by_day [ '<STR_LIT>' ] ) , [ unicode , str ] ) <EOL> if events_by_day [ '<STR_LIT>' ] : <EOL> self . assertEqual ( events_by_day [ '<STR_LIT:date>' ] , today_date ) <EOL> self . assertEqual ( events_by_day [ '<STR_LIT>' ] , today_short_date ) <EOL> def test_ajax_index_events_future ( self ) : <EOL> """<STR_LIT>""" <EOL> tomorrow = datetime . date . today ( ) + relativedelta ( days = <NUM_LIT:1> ) <EOL> tomorrow_date = format_ ( tomorrow , '<STR_LIT>' ) . capitalize ( ) <EOL> tomorrow_short_date = format_ ( tomorrow , '<STR_LIT>' ) <EOL> event = Event . objects . get ( id = <NUM_LIT:1> ) <EOL> event . start_date = tomorrow <EOL> event . save ( ) <EOL> resp = self . client . get ( '<STR_LIT>' , follow = True ) <EOL> events_dict = simplejson . loads ( resp . content ) <EOL> self . assertEqual ( resp . status_code , <NUM_LIT:200> ) <EOL> self . assertIn ( '<STR_LIT>' , events_dict ) <EOL> self . assertIn ( '<STR_LIT>' , events_dict ) <EOL> self . assertIn ( '<STR_LIT>' , events_dict ) <EOL> for i in range ( <NUM_LIT:7> ) : <EOL> events_by_day = events_dict [ '<STR_LIT>' ] [ str ( i ) ] <EOL> self . assertIn ( '<STR_LIT:date>' , events_by_day ) <EOL> self . assertIn ( type ( events_by_day [ '<STR_LIT:date>' ] ) , [ unicode , str ] ) <EOL> self . assertIn ( '<STR_LIT>' , events_by_day ) <EOL> self . assertEqual ( list , type ( events_by_day [ '<STR_LIT>' ] ) ) <EOL> self . assertIn ( '<STR_LIT>' , events_by_day ) <EOL> self . assertEqual ( bool , type ( events_by_day [ '<STR_LIT>' ] ) ) <EOL> self . assertIn ( '<STR_LIT>' , events_by_day ) <EOL> self . assertIn ( type ( events_by_day [ '<STR_LIT>' ] ) , [ unicode , str ] ) <EOL> if events_by_day [ '<STR_LIT>' ] : <EOL> self . assertEqual ( events_by_day [ '<STR_LIT:date>' ] , tomorrow_date ) <EOL> self . assertEqual ( events_by_day [ '<STR_LIT>' ] , tomorrow_short_date ) <EOL> class WWWTestCase ( TestCase ) : <EOL> fixtures = [ '<STR_LIT>' ] <EOL> def test_index ( self ) : <EOL> resp = self . client . get ( '<STR_LIT:/>' , follow = True ) <EOL> self . assertEqual ( resp . status_code , <NUM_LIT:200> ) <EOL> def test_public_event ( self ) : <EOL> resp = self . client . get ( '<STR_LIT>' , follow = True ) <EOL> self . assertEqual ( resp . status_code , <NUM_LIT:200> ) <EOL> self . assertRedirects ( resp , '<STR_LIT>' ) <EOL> resp = self . client . get ( '<STR_LIT>' , follow = True ) <EOL> self . assertEqual ( resp . status_code , <NUM_LIT:200> ) <EOL> self . assertListEqual ( resp . redirect_chain , [ ] ) <EOL> resp = self . client . get ( '<STR_LIT>' , <EOL> follow = True ) <EOL> self . assertEqual ( resp . status_code , <NUM_LIT:200> ) <EOL> self . assertRedirects ( resp , '<STR_LIT>' , status_code = <NUM_LIT> ) <EOL> def test_prostori ( self ) : <EOL> resp = self . client . get ( '<STR_LIT>' , follow = True ) <EOL> self . assertEqual ( resp . status_code , <NUM_LIT:200> ) <EOL> def test_feeds ( self ) : <EOL> resp = self . client . get ( '<STR_LIT>' , follow = True ) <EOL> self . assertEqual ( resp . status_code , <NUM_LIT:200> ) <EOL> resp = self . client . get ( '<STR_LIT>' , follow = True ) <EOL> self . assertEqual ( resp . status_code , <NUM_LIT:200> ) <EOL> resp = self . client . get ( '<STR_LIT>' , follow = True ) <EOL> self . assertEqual ( resp . status_code , <NUM_LIT:200> ) <EOL> resp = self . client . get ( '<STR_LIT>' , follow = True ) <EOL> self . assertEqual ( resp . status_code , <NUM_LIT:200> ) <EOL> resp = self . client . get ( '<STR_LIT>' , follow = True ) <EOL> self . assertEqual ( resp . status_code , <NUM_LIT:200> ) <EOL> resp = self . client . get ( '<STR_LIT>' , follow = True ) <EOL> self . assertEqual ( resp . status_code , <NUM_LIT:200> ) <EOL> resp = self . client . get ( '<STR_LIT>' , follow = True ) <EOL> self . assertEqual ( resp . status_code , <NUM_LIT:200> ) </s>
