From 2a16f5e053d96ef263e131fd2731b003c5403d33 Mon Sep 17 00:00:00 2001 From: Razvan Deaconescu Date: Fri, 19 Aug 2011 10:01:40 +0300 Subject: [PATCH] ppf: Add tests to select_btclients* methods. --- ppf/db/access.py | 2 +- ppf/db/tests/test_access_sqlite.py | 21 ++++++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/ppf/db/access.py b/ppf/db/access.py index 15e799c..33cf3c8 100644 --- a/ppf/db/access.py +++ b/ppf/db/access.py @@ -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 diff --git a/ppf/db/tests/test_access_sqlite.py b/ppf/db/tests/test_access_sqlite.py index bb397b4..b094f46 100644 --- a/ppf/db/tests/test_access_sqlite.py +++ b/ppf/db/tests/test_access_sqlite.py @@ -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']) -- 2.20.1