def test_init__no_args(self): from ebpub.db.schemafilters import AttributeFilter schemafield = self._mock_schemafield(name='mock-sf') qs = {} request = context = None filter = AttributeFilter(request, context, qs, schemafield=schemafield) self.assertEqual(filter.get_query_params(), {'by-mock-sf': ''})
def test_init__with_time(self): from ebpub.db.schemafilters import AttributeFilter schemafield = self._mock_schemafield(name='mock-sf') when = datetime.time(22, 40) qs = {} request = context = None filter = AttributeFilter(request, context, qs, when, schemafield=schemafield) self.assertEqual(filter.get_query_params(), {'by-mock-sf': '22:40:00'})
def test_init__with_datetime(self): from ebpub.db.schemafilters import AttributeFilter schemafield = self._mock_schemafield(name="mock-sf") when = datetime.datetime(2009, 1, 23, 22, 40) qs = {} request = context = None filter = AttributeFilter(request, context, qs, when, schemafield=schemafield) self.assertEqual(filter.get_query_params(), {"by-mock-sf": "2009-01-23T22:40:00"})