# Path: onedrived/od_dateutils.py
# def datetime_to_str(d):
# def str_to_datetime(s):
# def datetime_to_timestamp(d):
# def diff_timestamps(t1, t2):


import unittest
import arrow
from datetime import timezone, timedelta
from onedrived import od_dateutils




class TestDateUtils(unittest.TestCase):

    DT_OFFSET = timedelta(hours=1)
    DT_STR = '2015-08-06T18:45:20.260000Z'
    DT_TS = 1438886720.26
    DT_OBJ = arrow.Arrow(year=2015, month=8, day=6, hour=18, minute=45, second=20, microsecond=260000)
    DT_UTC_OBJ = DT_OBJ.replace(tzinfo=timezone.utc)
    DT_NONUTC_OBJ = DT_UTC_OBJ.replace(tzinfo=timezone(offset=DT_OFFSET))

    def test_str_to_datetime(self):
        self.assertEqual(self.DT_UTC_OBJ, od_dateutils.str_to_datetime(self.DT_STR))

    def test_datetime_to_str(self):

# Path: onedrived/od_dateutils.py
# def datetime_to_str(d):
# def str_to_datetime(s):
# def datetime_to_timestamp(d):
# def diff_timestamps(t1, t2):


# Path: tests/test_dateutils.py
import unittest
import arrow
from datetime import timezone, timedelta
from onedrived import od_dateutils





class TestDateUtils(unittest.TestCase):

    DT_OFFSET = timedelta(hours=1)
    DT_STR = '2015-08-06T18:45:20.260000Z'
    DT_TS = 1438886720.26
    DT_OBJ = arrow.Arrow(year=2015, month=8, day=6, hour=18, minute=45, second=20, microsecond=260000)
    DT_UTC_OBJ = DT_OBJ.replace(tzinfo=timezone.utc)
    DT_NONUTC_OBJ = DT_UTC_OBJ.replace(tzinfo=timezone(offset=DT_OFFSET))

    def test_str_to_datetime(self):
        self.assertEqual(self.DT_UTC_OBJ, od_dateutils.str_to_datetime(self.DT_STR))

    def test_datetime_to_str(self):

        self.assertEqual(self.DT_STR, od_dateutils.datetime_to_str(self.DT_UTC_OBJ))