Added mock code #1883

Open
kdcis wants to merge 10 commits from kdcis/mock-test into v0.6
5 changed files with 147 additions and 0 deletions
Showing only changes of commit ed1c8ca100 - Show all commits

View File

@ -0,0 +1,50 @@
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
"""
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
The objectProcessor thread, of which there is only one,
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
processes the network objects
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
"""
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
import logging
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
import random
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
import threading
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
import queues
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
import state
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
from helper_sql import sql_ready, sqlExecute, sqlQuery
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
from network import bmproto
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
logger = logging.getLogger('default')
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
class objectProcessor(threading.Thread):
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
"""
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
The objectProcessor thread, of which there is only one, receives network
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
objects (msg, broadcast, pubkey, getpubkey) from the receiveDataThreads.
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
"""
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
def __init__(self):
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
threading.Thread.__init__(self, name="objectProcessor")
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
random.seed()
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
# It may be the case that the last time Bitmessage was running,
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
# the user closed it before it finished processing everything in the
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
# objectProcessorQueue. Assuming that Bitmessage wasn't closed
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
# forcefully, it should have saved the data in the queue into the
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
# objectprocessorqueue table. Let's pull it out.
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
sql_ready.wait()
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
queryreturn = sqlQuery(
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
'SELECT objecttype, data FROM objectprocessorqueue')
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
for objectType, data in queryreturn:
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
queues.objectProcessorQueue.put((objectType, data))
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
sqlExecute('DELETE FROM objectprocessorqueue')
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
logger.debug(
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
'Loaded %s objects from disk into the objectProcessorQueue.',
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
len(queryreturn))
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
self._ack_obj = bmproto.BMStringParser()
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
self.successfullyDecryptMessageTimings = []
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
def run(self):
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
"""Process the objects from `.queues.objectProcessorQueue`"""
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
while True:
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
objectType, data = queues.objectProcessorQueue.get()
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
if state.shutdown:
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
state.shutdown = 2
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.
break
g1itch commented 2021-11-15 17:27:07 +01:00 (Migrated from github.com)
Review

it will never happen

it will never happen
g1itch commented 2021-11-15 17:32:32 +01:00 (Migrated from github.com)
Review

This is not a mock class because it uses sqlQuery() from helper_sql, thus depends on the sqlThread

This is not a mock class because it uses `sqlQuery()` from `helper_sql`, thus depends on the `sqlThread`
PeterSurda commented 2021-11-16 04:12:53 +01:00 (Migrated from github.com)
Review

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.

#1794 contains a test sql class (runs in-memory database and allows custom schema initialization), that will be used here as well.
PeterSurda commented 2021-11-16 07:39:10 +01:00 (Migrated from github.com)
Review

For the time being we can skip this, yes.

For the time being we can skip this, yes.

View File

@ -0,0 +1,45 @@
"""
Thread for performing PoW
"""
from __future__ import division
import proofofwork
import queues
import state
from network import StoppableThread
from six.moves import queue
class MockSingleWorker(StoppableThread):
"""Thread for performing PoW"""
def __init__(self):
super(MockSingleWorker, self).__init__(name="singleWorker")
proofofwork.init()
def stopThread(self):
"""Signal through the queue that the thread should be stopped"""
try:
queues.workerQueue.put(("stopThread", "data"))
except queue.Full:
self.logger.error('workerQueue is Full')
super(MockSingleWorker, self).stopThread()
def run(self):
if state.shutdown > 0:
return
while state.shutdown == 0:
self.busy = 0
command, data = queues.workerQueue.get()
self.busy = 1
if command == 'stopThread':
self.busy = 0
return
queues.workerQueue.task_done()
self.logger.info("Quitting...")

14
src/mock/inventory.py Normal file
View File

@ -0,0 +1,14 @@
"""The Inventory singleton"""
# TODO make this dynamic, and watch out for frozen, like with messagetypes
from singleton import Singleton
@Singleton
class MockInventory():
"""
Inventory singleton class which uses storage backends
to manage the inventory.
"""
def __init__(self):
self.numberOfInventoryLookupsPerformed = 0

View File

@ -0,0 +1,25 @@
"""
`BMConnectionPool` class definition
"""
import logging
import asyncore_pollchoose as asyncore
from bmconfigparser import BMConfigParser
from singleton import Singleton
logger = logging.getLogger('default')
@Singleton
class MockBMConnectionPool(object):
"""Pool of all existing connections"""
def __init__(self):
asyncore.set_rates(
BMConfigParser().safeGetInt(
"bitmessagesettings", "maxdownloadrate"),
BMConfigParser().safeGetInt(
"bitmessagesettings", "maxuploadrate")
)
self.outboundConnections = {}
self.inboundConnections = {}

13
src/mock/network/stats.py Normal file
View File

@ -0,0 +1,13 @@
"""
Network statistics
"""
def MockUploadSpeed():
"""Getting upload speed"""
return 0
def MockDownloadSpeed():
"""Getting download speed"""
return 0