# Path: seedbox/common/timeutil.py
# def utcnow():
# def is_older_than(before, seconds):
# def is_newer_than(after, seconds):
# def delta_seconds(before, after):
# def total_seconds(delta):
# ONE_WEEK = total_seconds(datetime.timedelta(weeks=1))
# 
# Path: seedbox/tests/test.py
# class ConfiguredBaseTestCase(BaseTestCase):
#     def setUp(self):
#     def tearDown(self):
#     def _make_dir(self, dirname):
#     def set_required_options(self):


import datetime
from seedbox.common import timeutil
from seedbox.tests import test
from __future__ import print_function




def advance_time_delta(dt, timedelta):
    return dt + timedelta


def advance_time_seconds(dt, seconds):
    return advance_time_delta(dt, datetime.timedelta(seconds=seconds))


class TimeutilTest(test.BaseTestCase):

    def test_is_older_than(self):
        _past = advance_time_seconds(timeutil.utcnow(), -10)
        self.assertTrue(timeutil.is_older_than(_past, 5))
        self.assertFalse(timeutil.is_older_than(_past, 15))

    def test_is_newer_than(self):
        _future = advance_time_seconds(timeutil.utcnow(), 10)
        self.assertTrue(timeutil.is_newer_than(_future, 5))
        self.assertFalse(timeutil.is_newer_than(_future, 15))

    def test_delta_seconds(self):
        _future = advance_time_seconds(timeutil.utcnow(), 10)

# Path: seedbox/common/timeutil.py
# def utcnow():
# def is_older_than(before, seconds):
# def is_newer_than(after, seconds):
# def delta_seconds(before, after):
# def total_seconds(delta):
# ONE_WEEK = total_seconds(datetime.timedelta(weeks=1))
# 
# Path: seedbox/tests/test.py
# class ConfiguredBaseTestCase(BaseTestCase):
#     def setUp(self):
#     def tearDown(self):
#     def _make_dir(self, dirname):
#     def set_required_options(self):


# Path: seedbox/tests/common/test_timeutil.py
import datetime
from seedbox.common import timeutil
from seedbox.tests import test

from __future__ import print_function




def advance_time_delta(dt, timedelta):
    return dt + timedelta


def advance_time_seconds(dt, seconds):
    return advance_time_delta(dt, datetime.timedelta(seconds=seconds))


class TimeutilTest(test.BaseTestCase):

    def test_is_older_than(self):
        _past = advance_time_seconds(timeutil.utcnow(), -10)
        self.assertTrue(timeutil.is_older_than(_past, 5))
        self.assertFalse(timeutil.is_older_than(_past, 15))

    def test_is_newer_than(self):
        _future = advance_time_seconds(timeutil.utcnow(), 10)
        self.assertTrue(timeutil.is_newer_than(_future, 5))
        self.assertFalse(timeutil.is_newer_than(_future, 15))

    def test_delta_seconds(self):
        _future = advance_time_seconds(timeutil.utcnow(), 10)

        self.assertTrue(timeutil.delta_seconds(timeutil.utcnow(), _future), 10)