def test_teDate(self): """ Testing if conversion to TimeEdit-format is done correctly """ testDataTime = datetime.datetime(2012, 12, 13, 7, 10, 0, 0) test = dateparser.teDate(testDataTime) self.assertEqual(test, "1250")
def getClassSchedule(classchoice, rawdate): classIdentifier = classID(classchoice) datechoice = parseDate(rawdate) if classIdentifier == None: # Abort operation if no class with name classchoice can be found. abort(404) url = "http://schema.abbindustrigymnasium.se:8080/" +\ "4DACTION/iCal_downloadReservations/timeedit.vcs?" url += "from=" + teDate(datechoice) + "&" url += "to=" + teDate(datechoice) + "&" url += "id1=" + classIdentifier fetchVcsUrl = urllib2.urlopen(url) # Fetch the VCS-file urlData = fetchVcsUrl.read() # Get the raw-text VCS schedule = cleanVcsFile(urlData) return formatVcs(schedule, datechoice)