ppf: Complete SQLite add_* message tests.
authorRazvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Mon, 22 Aug 2011 10:22:32 +0000 (13:22 +0300)
committerRazvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Mon, 22 Aug 2011 10:22:32 +0000 (13:22 +0300)
ppf/new/tests/test_storage.py

index 6c05686..4d7df81 100644 (file)
@@ -11,6 +11,7 @@ import shutil
 import sqlite3
 import subprocess
 import sys
+import datetime
 
 import storage
 
@@ -439,7 +440,9 @@ class SQLiteDatabaseAccessTest(unittest.TestCase):
 
     def test_add_status_message_new_entry_in_table(self):
         # Add new status message.
-        msg = storage.StatusMessage(client_session_id=1,
+        ts = datetime.datetime.strptime("2010-09-12 08:43:15",
+                "%Y-%m-%d %H:%M:%S")
+        msg = storage.StatusMessage(client_session_id=1, timestamp=ts,
                 num_peers=10, num_dht_peers=3, download_speed=102,
                 upload_speed=99, download_size=10213, upload_size=3301)
         a = storage.SQLiteDatabaseAccess(self.database)
@@ -455,7 +458,9 @@ class SQLiteDatabaseAccessTest(unittest.TestCase):
 
     def test_add_peer_status_message_new_entry_in_table(self):
         # Add new peer status message.
-        msg = storage.PeerStatusMessage(client_session_id=1,
+        ts = datetime.datetime.strptime("2010-09-12 13:43:25",
+                "%Y-%m-%d %H:%M:%S")
+        msg = storage.PeerStatusMessage(client_session_id=1, timestamp=ts,
                 peer_ip="141.85.224.202", peer_port="12345",
                 download_speed=13, upload_speed=98)
         a = storage.SQLiteDatabaseAccess(self.database)
@@ -471,7 +476,9 @@ class SQLiteDatabaseAccessTest(unittest.TestCase):
 
     def test_add_verbose_message_new_entry_in_databas(self):
         # Add new verbose message.
-        msg = storage.VerboseMessage(client_session_id=1,
+        ts = datetime.datetime.strptime("2010-09-12 13:43:24",
+                "%Y-%m-%d %H:%M:%S")
+        msg = storage.VerboseMessage(client_session_id=1, timestamp=ts,
             transfer_direction="send", peer_ip="141.85.224.202",
             peer_port="12345", message_type="CHOKE")
         a = storage.SQLiteDatabaseAccess(self.database)