Esempio n. 1
0
    def get(self, clientversion, year=None, month=None, day=None):
        self.response.headers['Content-Type'] = 'text/plain'
        self.response.headers['Access-Control-Allow-Origin'] = '*'
        try:
            if needschedule(year,month,day):
                self.response.out.write('#schedule {:%Y.%m.%d}\n'.format(date.today()))
                self.response.out.write(CalcSchedule.getSchedule(clientversion))
                self.response.out.write('#name ' + CurrentSchedule.schedulename + '\n')

            special = CalcSchedule.getSpecial(clientversion);
            if special:
                self.response.out.write('#special\n')
                self.response.out.write(special)

            if Alert.hasAlerts():
                self.response.out.write('#allalerts\n')
                for alert in Alert.allAlerts():
                    self.response.out.write(str(alert))
                self.response.out.write('__\n')
        except:
            AdminUtils.handleError()
        finally:
            self.response.out.write('#done\n')
Esempio n. 2
0
def test_canonical():
	CurrentSchedule.CurrentSchedule = biglist # DANGER, DESTRUCTIVE, DO NOT TRY THIS AT HOME
	result = CalcSchedule.getSchedule("3.0")
	assert result == canonicalresult, "Checking canonical result"
	print "test_canonical passed"
Esempio n. 3
0
def test_versionify():
	result = CalcSchedule.textify(CalcSchedule.versionify(smallist,"2.0"),False)
	assert result=="bainbridge,es,200,201,320,425,525,575,625\nedmonds,ws,200,201,335,380,430\n", "Checking v2 added times"
	result = CalcSchedule.textify(CalcSchedule.versionify(ptdeflist,"4.0"), False)
	assert result=="vashon-pt defiance,es,380,430\npt defiance-vashon,ws,305,355\n", "Checking pt defiance turn-around"
	print "test_versionify passed"
Esempio n. 4
0
def test_textify():
	result = CalcSchedule.textify(smallist,True)
	assert result == "bainbridge,ee,320,425,525,575,625\nedmonds,wd,335,380,430\n", "Checking canonical result"
	result = CalcSchedule.textify(smallist,False)
	assert result == "bainbridge,es,320,425,525,575,625\nedmonds,ws,335,380,430\n", "Checking daily result"
	print "test_textify passed"