def test_transformation(self): dt = parse_utc_datetime('2014-04-16 12:12:12') indata = dict(timestamp=dt) response = json_response(indata) outdata = json.loads(response.content) self.assertEquals( parse_utc_datetime(outdata['timestamp'], JSON_DATETIME_FORMAT), indata['timestamp'].astimezone(local_timezone) )
def test_extents(self): e = Extents(period='year') response = json_response(e) response_json = json.loads(response.content) start, end = e self.assertEquals( parse_utc_datetime(response_json[0], JSON_DATETIME_FORMAT).year, start.year )
def test_parsed(self): ''' Test with a couple of timestamps from a real log ''' with open('tests/fixtures/timestamps.txt', 'r') as stamps: for line in stamps: t = parse_utc_datetime(line.strip()) t = round_to_minute(t) self.assertEqual(t.second, 0)