summaryrefslogtreecommitdiffstats
path: root/bindings/python/tests
diff options
context:
space:
mode:
Diffstat (limited to 'bindings/python/tests')
-rw-r--r--bindings/python/tests/tests.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/bindings/python/tests/tests.py b/bindings/python/tests/tests.py
index 09c89bf..f52015e 100644
--- a/bindings/python/tests/tests.py
+++ b/bindings/python/tests/tests.py
@@ -2,6 +2,8 @@ import unittest
import shutil
import tempfile
import os
+import datetime
+import time
import types
gpod = __import__('__init__')
@@ -63,6 +65,21 @@ class TestiPodFunctions(unittest.TestCase):
self.db.remove(track, ipod=True)
self.failIf(os.path.exists(track_file))
+ def testDatestampSetting(self):
+ trackname = os.path.join(self.mp,
+ 'iPod_Control',
+ 'tiny.mp3')
+ t = self.db.new_Track(filename=trackname)
+ date = datetime.datetime.now()
+ t['time_added'] = date
+ self.assertEqual(date.year, t['time_added'].year)
+ self.assertEqual(date.second, t['time_added'].second)
+ # microsecond won't match, that's lost in the itdb
+ date = datetime.datetime.now()
+ t['time_added'] = time.mktime(date.timetuple())
+ self.assertEqual(date.year, t['time_added'].year)
+ self.assertEqual(date.second, t['time_added'].second)
+
def testVersion(self):
self.assertEqual(type(gpod.version_info),
types.TupleType)