class TestDateLimitedObjectHandlerUnit(unittest.TestCase):
    def setUp(self):
        self.app = Application([('/', DateLimitedObjectHandler),])
        self.req = Mock()
        self.objects_handler = DateLimitedObjectHandler(self.app, self.req)

    def test_get_objects(self):
        expected = []

        MockObject = Mock()
        MockObject.get_objects = Mock(return_value=expected)
        with patch.object(zoneserver, 'Object', MockObject):
            result = self.objects_handler.get_objects()

        self.assertEqual(expected, result)

    def test_get_objects_with_since(self):
        expected = []

        MockObject = Mock()
        MockObject.get_objects = Mock(return_value=expected)
        with patch.object(zoneserver, 'Object', MockObject):
            result = self.objects_handler.get_objects(since=datetime.datetime.now())
            print result

        self.assertEqual(expected, result)
class TestDateLimitedObjectHandlerUnit(unittest.TestCase):
    def setUp(self):
        self.app = Application([
            ('/', DateLimitedObjectHandler),
        ])
        self.req = Mock()
        self.objects_handler = DateLimitedObjectHandler(self.app, self.req)

    def test_get_objects(self):
        expected = []

        MockObject = Mock()
        MockObject.get_objects = Mock(return_value=expected)
        with patch.object(zoneserver, 'Object', MockObject):
            result = self.objects_handler.get_objects()

        self.assertEqual(expected, result)

    def test_get_objects_with_since(self):
        expected = []

        MockObject = Mock()
        MockObject.get_objects = Mock(return_value=expected)
        with patch.object(zoneserver, 'Object', MockObject):
            result = self.objects_handler.get_objects(
                since=datetime.datetime.now())
            print result

        self.assertEqual(expected, result)
 def setUp(self):
     self.app = Application([('/', DateLimitedObjectHandler),])
     self.req = Mock()
     self.objects_handler = DateLimitedObjectHandler(self.app, self.req)
 def setUp(self):
     self.app = Application([
         ('/', DateLimitedObjectHandler),
     ])
     self.req = Mock()
     self.objects_handler = DateLimitedObjectHandler(self.app, self.req)