ppf: Add tests to select_btclients* methods.
authorRazvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Fri, 19 Aug 2011 07:01:40 +0000 (10:01 +0300)
committerRazvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Fri, 19 Aug 2011 07:01:40 +0000 (10:01 +0300)
ppf/db/access.py
ppf/db/tests/test_access_sqlite.py

index 15e799c..33cf3c8 100644 (file)
@@ -48,7 +48,7 @@ class DatabaseAccess:
         pass
 
     def insert_btclients(self, client_name, language, dht, streaming):
-        insert_btclients_row([client_name, language, dht, streaming])
+        self.insert_btclients_row([client_name, language, dht, streaming])
 
     def select_btclients(self, show=True, id=-1):
         pass
index bb397b4..b094f46 100644 (file)
@@ -207,12 +207,24 @@ class AccessTest(unittest.TestCase):
         self.assertEqual(id, 1)
 
     def test_insert_btclients_row(self):
-        # TODO
-        self.assertEqual(True, True)
+        self.dba.insert_btclients_row(['NextShare', 'Python', 1, 0]);
+        self.dba.select_btclients(False)
+
+        num_rows = 0
+        for row in self.cursor:
+            num_rows = num_rows+1
+
+        self.assertEqual(num_rows, 7)
 
     def test_insert_btclients(self):
-        # TODO
-        self.assertEqual(True, True)
+        self.dba.insert_btclients('NextShare', 'Python', 1, 0);
+        self.dba.select_btclients(False)
+
+        num_rows = 0
+        for row in self.cursor:
+            num_rows = num_rows+1
+
+        self.assertEqual(num_rows, 7)
 
     def test_select_client_sessions_by_id(self):
         # TODO: An entry should be added in the startup script.
@@ -354,7 +366,6 @@ class AccessTest(unittest.TestCase):
 
         self.assertEqual(num_rows, 1)
 
-
     def test_delete_verbose_messages(self):
         self.dba.insert_swarms("fedora.torrent", 10000, "btex", "isohunt")
         self.dba.insert_client_sessions_row(['1', '2', 'Linux', '2.6.26', '512', '1500', '141.85.224.205', '50500', '512', '64', '2455125.02409722'])