[CalendarServer-changes] [10267] CalendarServer/branches/users/glyph/queue-locking-and-timing

source_changes at macosforge.org source_changes at macosforge.org
Fri Jan 4 16:39:32 PST 2013


Revision: 10267
          http://trac.calendarserver.org//changeset/10267
Author:   glyph at apple.com
Date:     2013-01-04 16:39:32 -0800 (Fri, 04 Jan 2013)
Log Message:
-----------
Timestamps should be timestamps.

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/queue-locking-and-timing/twext/enterprise/dal/test/test_record.py

Property Changed:
----------------
    CalendarServer/branches/users/glyph/queue-locking-and-timing/

Modified: CalendarServer/branches/users/glyph/queue-locking-and-timing/twext/enterprise/dal/test/test_record.py
===================================================================
--- CalendarServer/branches/users/glyph/queue-locking-and-timing/twext/enterprise/dal/test/test_record.py	2013-01-05 00:39:31 UTC (rev 10266)
+++ CalendarServer/branches/users/glyph/queue-locking-and-timing/twext/enterprise/dal/test/test_record.py	2013-01-05 00:39:32 UTC (rev 10267)
@@ -18,6 +18,8 @@
 Test cases for L{twext.enterprise.dal.record}.
 """
 
+import datetime
+
 from twisted.internet.defer import inlineCallbacks
 
 from twisted.trial.unittest import TestCase
@@ -38,7 +40,8 @@
 schemaString = """
 create table ALPHA (BETA integer primary key, GAMMA text);
 create table DELTA (PHI integer primary key default (nextval('myseq')),
-                    EPSILON text not null);
+                    EPSILON text not null,
+                    ZETA timestamp not null default '2012-12-12 12:12:12' );
 """
 
 # sqlite can be made to support nextval() as a function, but 'create sequence'
@@ -139,6 +142,17 @@
 
 
     @inlineCallbacks
+    def test_datetimeType(self):
+        """
+        When a L{Record} references a timestamp column, it retrieves the date
+        as UTC.
+        """
+        txn = self.pool.connection()
+        rec = yield TestAutoRecord.create(txn, epsilon=1)
+        self.assertEquals(rec.zeta, datetime.datetime(2012, 12, 12, 12, 12, 12))
+
+
+    @inlineCallbacks
     def test_tooManyAttributes(self):
         """
         When a L{Record} object is created with unknown attributes (those which
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130104/038d7a2c/attachment.html>


More information about the calendarserver-changes mailing list