# Increment number of entries in the swarm table.
self.expected_swarms_count = self.expected_swarms_count + 2
+ def insert_test_btclients(self):
+ """ Insert test entries through insert_btclients_row method. """
+ self.dba.insert_btclients_row(['NextShare', 'Python', 1, 1]);
+ self.dba.insert_btclients_row(['Deluge', 'C++', 1, 0]);
+
+ # Increment number of entries in the btclients table.
+ self.expected_btclients_count = self.expected_btclients_count + 2
+
def test_connect(self):
""" If connection is successful, no exception is raised. """
try:
self.assertEqual(num_rows, self.expected_swarms_count)
def test_select_btclients(self):
+ """
+ Select initial btclient entries.
+ Check against expected_btclients_count.
+ """
self.dba.select_btclients(False)
num_rows = self.get_cursor_num_rows()
- self.assertEqual(num_rows, 6)
+ self.assertEqual(num_rows, self.expected_btclients_count)
def test_select_btclients_by_name(self):
+ """
+ Select btclients by name. Use "Tribler" name resulting in one entry.
+ """
self.dba.select_btclients_by_name("Tribler", False)
num_rows = self.get_cursor_num_rows()
self.assertEqual(num_rows, 1)
def test_select_btclients_id_by_name(self):
+ """
+ Select bctlients id by name. "Tibler" should return be client id 1.
+ """
# TODO: unify return values for select_* methods in access.py
id = self.dba.select_btclients_id_by_name("Tribler")
self.assertEqual(id, 1)
def test_insert_btclients_row(self):
- self.dba.insert_btclients_row(['NextShare', 'Python', 1, 0]);
+ """
+ Use insert_test_btclients to add new entries in btclients table.
+ Test number of rows selected against expected_btclients_count.
+ """
+ self.insert_test_btclients()
self.dba.select_btclients(False)
num_rows = self.get_cursor_num_rows()
- self.assertEqual(num_rows, 7)
+ self.assertEqual(num_rows, self.expected_btclients_count)
def test_insert_btclients(self):
- self.dba.insert_btclients('NextShare', 'Python', 1, 0);
+ """
+ Use insert_test_btclients to add new entries in swarms table.
+ Test number of rows selected against expected_btclients_count.
+ """
+ self.insert_test_btclients()
self.dba.select_btclients(False)
num_rows = self.get_cursor_num_rows()
- self.assertEqual(num_rows, 7)
+ self.assertEqual(num_rows, self.expected_btclients_count)
def test_select_client_sessions_by_id(self):
# TODO: An entry should be added in the startup script.