Test for helper_sql #2196

Merged
anand-skss merged 1 commits from test_case into v0.6 2024-03-22 06:26:48 +01:00
2 changed files with 132 additions and 0 deletions
Showing only changes of commit 2e98a1eb2d - Show all commits

View File

@ -2,6 +2,7 @@ coverage
psutil
pycryptodome
PyQt5;python_version>="3.7"
mock;python_version<="2.7"
python_prctl;platform_system=="Linux"
six
xvfbwrapper;platform_system=="Linux"

View File

@ -0,0 +1,131 @@
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
"""Test cases for helper_sql"""
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
import unittest
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
try:
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
# Python 3
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
from unittest.mock import patch
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
except ImportError:
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
# Python 2
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
from mock import patch
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
import pybitmessage.helper_sql as helper_sql
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
class TestHelperSql(unittest.TestCase):
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
"""Test class for helper_sql"""
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
@classmethod
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
def setUpClass(cls):
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
helper_sql.sql_available = True
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
@patch("pybitmessage.helper_sql.sqlSubmitQueue.put")
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
@patch("pybitmessage.helper_sql.sqlReturnQueue.get")
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
def test_sqlquery_no_args(self, mock_sqlreturnqueue_get, mock_sqlsubmitqueue_put):
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
"""Test sqlQuery with no additional arguments"""
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
mock_sqlreturnqueue_get.return_value = ("dummy_result", None)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
result = helper_sql.sqlQuery(
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
"SELECT msgid FROM inbox where folder='inbox' ORDER BY received"
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
self.assertEqual(mock_sqlsubmitqueue_put.call_count, 2)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
self.assertEqual(result, "dummy_result")
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
@patch("pybitmessage.helper_sql.sqlSubmitQueue.put")
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
@patch("pybitmessage.helper_sql.sqlReturnQueue.get")
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
def test_sqlquery_with_args(self, mock_sqlreturnqueue_get, mock_sqlsubmitqueue_put):
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
"""Test sqlQuery with additional arguments"""
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
mock_sqlreturnqueue_get.return_value = ("dummy_result", None)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
result = helper_sql.sqlQuery(
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
"SELECT address FROM addressbook WHERE address=?", "PB-5yfds868gbkj"
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
self.assertEqual(mock_sqlsubmitqueue_put.call_count, 2)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
self.assertEqual(result, "dummy_result")
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
@patch("pybitmessage.helper_sql.sqlSubmitQueue.put")
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
@patch("pybitmessage.helper_sql.sqlReturnQueue.get")
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
def test_sqlexecute(self, mock_sqlreturnqueue_get, mock_sqlsubmitqueue_put):
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
"""Test sqlExecute with valid arguments"""
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
mock_sqlreturnqueue_get.return_value = (None, 1)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
rowcount = helper_sql.sqlExecute(
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
"UPDATE sent SET status = 'msgqueued'"
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
"WHERE ackdata = ? AND folder = 'sent'",
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
"1710652313",
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
self.assertEqual(mock_sqlsubmitqueue_put.call_count, 3)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
self.assertEqual(rowcount, 1)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
@patch("pybitmessage.helper_sql.SqlBulkExecute.execute")
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
def test_sqlexecute_script(self, mock_execute):
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
"""Test sqlExecuteScript with a SQL script"""
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
helper_sql.sqlExecuteScript(
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
"CREATE TABLE test (id INTEGER); INSERT INTO test VALUES (1);"
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
self.assertTrue(mock_execute.assert_called)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
@patch("pybitmessage.helper_sql.sqlSubmitQueue.put")
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
@patch(
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
"pybitmessage.helper_sql.sqlReturnQueue.get",
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
def test_sqlexecute_chunked(self, mock_sqlreturnqueue_get, mock_sqlsubmitqueue_put):
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
"""Test sqlExecuteChunked with valid arguments"""
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
# side_effect is list of return value (_, rowcount)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
# of sqlReturnQueue.get for each chunk
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
CHUNK_COUNT = 6
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
CHUNK_SIZE = 999
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
ID_COUNT = CHUNK_COUNT * CHUNK_SIZE
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
CHUNKS_ROWCOUNT_LIST = [50, 29, 28, 18, 678, 900]
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
TOTAL_ROW_COUNT = sum(CHUNKS_ROWCOUNT_LIST)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
mock_sqlreturnqueue_get.side_effect = [(None, rowcount) for rowcount in CHUNKS_ROWCOUNT_LIST]
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
args = []
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
for i in range(0, ID_COUNT):
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
args.append("arg{}".format(i))
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
total_row_count_return = helper_sql.sqlExecuteChunked(
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
"INSERT INTO table VALUES {}", ID_COUNT, *args
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
self.assertEqual(TOTAL_ROW_COUNT, total_row_count_return)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
self.assertTrue(mock_sqlsubmitqueue_put.called)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
self.assertTrue(mock_sqlreturnqueue_get.called)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
@patch("pybitmessage.helper_sql.sqlSubmitQueue.put")
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
@patch("pybitmessage.helper_sql.sqlReturnQueue.get")
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
def test_sqlexecute_chunked_with_idcount_zero(
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
self, mock_sqlreturnqueue_get, mock_sqlsubmitqueue_put
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
):
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
"""Test sqlExecuteChunked with id count 0"""
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
ID_COUNT = 0
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
args = list()
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
for i in range(0, ID_COUNT):
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
args.append("arg{}".format(i))
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
total_row_count = helper_sql.sqlExecuteChunked(
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
"INSERT INTO table VALUES {}", ID_COUNT, *args
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
self.assertEqual(total_row_count, 0)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
self.assertFalse(mock_sqlsubmitqueue_put.called)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
self.assertFalse(mock_sqlreturnqueue_get.called)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
@patch("pybitmessage.helper_sql.sqlSubmitQueue.put")
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
@patch("pybitmessage.helper_sql.sqlReturnQueue.get")
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
def test_sqlexecute_chunked_with_args_less(
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
self, mock_sqlreturnqueue_get, mock_sqlsubmitqueue_put
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
):
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
"""Test sqlExecuteChunked with length of args less than idcount"""
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
ID_COUNT = 12
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
args = ["args0", "arg1"]
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
total_row_count = helper_sql.sqlExecuteChunked(
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
"INSERT INTO table VALUES {}", ID_COUNT, *args
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
self.assertEqual(total_row_count, 0)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
self.assertFalse(mock_sqlsubmitqueue_put.called)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
self.assertFalse(mock_sqlreturnqueue_get.called)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
@patch("pybitmessage.helper_sql.sqlSubmitQueue.put")
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
@patch("pybitmessage.helper_sql.sqlSubmitQueue.task_done")
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
def test_sqlstored_procedure(self, mock_task_done, mock_sqlsubmitqueue_put):
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
"""Test sqlStoredProcedure with a stored procedure name"""
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
helper_sql.sqlStoredProcedure("exit")
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
self.assertTrue(mock_task_done.called_once)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
mock_sqlsubmitqueue_put.assert_called_with("terminate")
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
@classmethod
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
def tearDownClass(cls):
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)
helper_sql.sql_available = False
PeterSurda commented 2024-03-21 03:51:10 +01:00 (Migrated from github.com)
Review

No magic values (10, 20, 30)

No magic values (10, 20, 30)