def test_datetime_encode(self): test_dates = {(1975, 5, 7, 0, 15): "1975-05-07T00:15:00", (1969, 7, 21, 2, 56, 15): "1969-07-21T02:56:15"} for data, expected in test_dates.iteritems(): data = datetime(*data) value = ISODateTime.encode(data) self.assertEqual(value, expected)
def test_datetime_decode(self): test_dates = {"1975-05-07T00:15": (1975, 5, 7, 0, 15), "1969-07-21T02:56:15": (1969, 7, 21, 2, 56, 15)} for data, result in test_dates.iteritems(): value = ISODateTime.decode(data) expected = datetime(*result) self.assertEqual(value, expected)
def test_datetime_encode(self): test_dates = { (1975, 5, 7, 0,15): '1975-05-07T00:15:00', (1969, 7, 21, 2, 56, 15): '1969-07-21T02:56:15'} for data, expected in test_dates.iteritems(): data = datetime(*data) value = ISODateTime.encode(data) self.assertEqual(value, expected)
def test_datetime_decode(self): test_dates = { '1975-05-07T00:15': (1975, 5, 7, 0,15), '1969-07-21T02:56:15': (1969, 7, 21, 2, 56, 15)} for data, result in test_dates.iteritems(): value = ISODateTime.decode(data) expected = datetime(*result) self.assertEqual(value, expected)
def get_metadata_schema(cls): schema = ShopFolder.get_metadata_schema() schema.update(WorkflowAware.get_metadata_schema()) schema['total_price'] = Decimal(title=MSG(u'Total price')) schema['shipping_price'] = Decimal schema['total_weight'] = Decimal schema['creation_datetime'] = ISODateTime(title=MSG(u'Creation date')) schema['customer_id'] = Users_Enumerate schema['payment_mode'] = PaymentWaysEnumerate schema['shipping'] = ShippingWaysEnumerate schema['delivery_address'] = Integer schema['bill_address'] = Integer # States schema['is_payed'] = Boolean(default=False) schema['is_sent'] = Boolean(default=False) return schema