#NEWLINE# def test_all_appointments_a_whole_day( self ) : #NEWLINE# #INDENT# start_time = 948816000 #NEWLINE# end_time = 948902400 #NEWLINE# timezone = 8.0 #NEWLINE# day_seconds = ( 24 * 3600 ) #NEWLINE# date = '2000-01-26' #NEWLINE# apt1 = self . make_an_appointment ( start_time , end_time , timezone ) #NEWLINE# db . session . add ( apt1 ) #NEWLINE# db . session . commit ( ) #NEWLINE# url = ( '/appointment/?date=%s&timezone=%s' % ( date , timezone ) ) #NEWLINE# resp = self . client . get ( url ) #NEWLINE# self . assert200 ( resp ) #NEWLINE# self . assertEqual ( resp . json [ 'date' ] , date ) #NEWLINE# self . assertEqual ( resp . json [ 'apt_time_utc_seconds' ] , [ [ start_time , end_time ] ] ) #NEWLINE# self . assertEqual ( resp . json [ 'timezone' ] , timezone ) #NEWLINE# self . assertEqual ( resp . json [ 'apt_time_slider_minutes' ] , [ [ 0 , 1440 ] ] ) #NEWLINE# url = ( '/appointment/?date=%s&timezone=%s' % ( date , ( timezone + 1 ) ) ) #NEWLINE# resp = self . client . get ( url ) #NEWLINE# self . assert200 ( resp ) #NEWLINE# self . assertEqual ( resp . json [ 'date' ] , date ) #NEWLINE# self . assertEqual ( resp . json [ 'apt_time_utc_seconds' ] , [ [ start_time , end_time ] ] ) #NEWLINE# self . assertEqual ( resp . json [ 'timezone' ] , ( timezone + 1 ) ) #NEWLINE# self . assertEqual ( resp . json [ 'apt_time_slider_minutes' ] , [ [ ( 0 + 60 ) , 1440 ] ] ) #NEWLINE# url = ( '/appointment/?date=%s&timezone=%s' % ( date , ( timezone - 3 ) ) ) #NEWLINE# resp = self . client . get ( url ) #NEWLINE# self . assert200 ( resp ) #NEWLINE# self . assertEqual ( resp . json [ 'date' ] , date ) #NEWLINE# self . assertEqual ( resp . json [ 'apt_time_utc_seconds' ] , [ [ start_time , end_time ] ] ) #NEWLINE# self . assertEqual ( resp . json [ 'timezone' ] , ( timezone - 3 ) ) #NEWLINE# self . assertEqual ( resp . json [ 'apt_time_slider_minutes' ] , [ [ 0 , ( 1440 - ( 60 * 3 ) ) ] ] ) #NEWLINE# apt2 = self . make_an_appointment ( ( start_time + day_seconds ) , ( end_time + day_seconds ) , timezone ) #NEWLINE# db . session . add ( apt2 ) #NEWLINE# db . session . commit ( ) #NEWLINE# for tz_delta in range ( ( - 12 ) , 0 ) : #NEWLINE# #INDENT# tz = ( timezone + tz_delta ) #NEWLINE# url = ( '/appointment/?date=%s&timezone=%s' % ( date , tz ) ) #NEWLINE# resp = self . client . get ( url ) #NEWLINE# self . assert200 ( resp ) #NEWLINE# self . assertEqual ( resp . json [ 'date' ] , date ) #NEWLINE# self . assertEqual ( resp . json [ 'apt_time_utc_seconds' ] , [ [ start_time , ( start_time + day_seconds ) ] , [ ( start_time + day_seconds ) , ( end_time + day_seconds ) ] ] ) #NEWLINE# self . assertEqual ( resp . json [ 'timezone' ] , tz ) #NEWLINE# self . assertEqual ( resp . json [ 'apt_time_slider_minutes' ] , [ [ 0 , ( 1440 + ( tz_delta * 60 ) ) ] , [ ( 1440 + ( tz_delta * 60 ) ) , 1440 ] ] )