Skip to content
Snippets Groups Projects
Commit 0c268169 authored by inso's avatar inso
Browse files

Initializing tests with pretenders

parent 94a3975d
No related branches found
No related tags found
No related merge requests found
import sys import sys
import os import os
import unittest import unittest
import subprocess
import time
cmd = 'python -m pretenders.server.server --host 0.0.0.0 --port 50000'
p = subprocess.Popen(cmd)
time.sleep(2)
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), 'lib'))) sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), 'lib')))
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), 'src'))) sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), 'src')))
print("Run")
runner = unittest.TextTestRunner().run(unittest.defaultTestLoader.discover(start_dir='cutecoin.tests', pattern='test_*')) runner = unittest.TextTestRunner().run(unittest.defaultTestLoader.discover(start_dir='cutecoin.tests', pattern='test_*'))
print("Terminate")
p.terminate()
sys.exit(not runner.wasSuccessful()) sys.exit(not runner.wasSuccessful())
\ No newline at end of file
...@@ -72,6 +72,7 @@ class Node(QObject): ...@@ -72,6 +72,7 @@ class Node(QObject):
def handle_reply(reply): def handle_reply(reply):
if reply.error() == QNetworkReply.NoError: if reply.error() == QNetworkReply.NoError:
strdata = bytes(reply.readAll()).decode('utf-8') strdata = bytes(reply.readAll()).decode('utf-8')
logging.debug(strdata)
nonlocal peer_data nonlocal peer_data
peer_data = json.loads(strdata) peer_data = json.loads(strdata)
future_reply.set_result(True) future_reply.set_result(True)
......
...@@ -45,10 +45,10 @@ class StepPageInit(Step): ...@@ -45,10 +45,10 @@ class StepPageInit(Step):
self.node = yield from Node.from_address(self.config_dialog.app.network_manager, None, server, port) self.node = yield from Node.from_address(self.config_dialog.app.network_manager, None, server, port)
if self.node: if self.node:
self.config_dialog.button_next.setEnabled(True) self.config_dialog.button_next.setEnabled(True)
self.config_dialog.button_check_node.setText("Ok !") self.config_dialog.button_checknode.setText("Ok !")
else: else:
self.config_dialog.button_next.setEnabled(False) self.config_dialog.button_next.setEnabled(False)
self.config_dialog.button_check_node.setText("Could not connect.") self.config_dialog.button_checknode.setText("Could not connect.")
@pyqtSlot() @pyqtSlot()
def check_node(self): def check_node(self):
......
__author__ = 'ggoinvic'
__author__ = 'ggoinvic'
from pretenders.client.http import HTTPMock
from pretenders.common.constants import FOREVER
bma_block_0 = b"""{
"version": 1,
"nonce": 10144,
"number": 0,
"powMin": 3,
"time": 1421838980,
"medianTime": 1421838980,
"membersCount": 4,
"monetaryMass": 0,
"currency": "meta_brouzouf",
"issuer": "HnFcSms8jzwngtVomTTnzudZx7SHUQY8sVE1y8yBmULk",
"signature": "+78w7251vvRdhoIJ6IWHEiEOLxNrmfQf45Y5sYvPdnAdXkVpO1unMV5YA/G5Vhphyz1dICrbeKCPM5qbFsoWAQ==",
"hash": "00063EB6E83F8717CEF1D25B3E2EE308374A14B1",
"parameters": "0.1:86400:100:604800:2629800:3:3:2629800:3:11:600:20:144:0.67",
"previousHash": null,
"previousIssuer": null,
"dividend": null,
"membersChanges": [ ],
"identities":
[
"8Fi1VSTbjkXguwThF4v2ZxC5whK7pwG2vcGTkPUPjPGU:Ot3zIp/nsHT3zgJy+2YcXPL6vaM5WFsD+F8w3qnJoBRuBG6lv761zoaExp2iyUnm8fDAyKPpMxRK2kf437QSCw==:1421787800:inso",
"HnFcSms8jzwngtVomTTnzudZx7SHUQY8sVE1y8yBmULk:GZKLgaxJKL+GqxVLePMt8OVLJ6qTLrib5Mr/j2gjiNRY2k485YLB2OlzhBzZVnD3xLs0xi69JUfmLnM54j3aCA==:1421786393:cgeek",
"BMAVuMDcGhYAV4wA27DL1VXX2ZARZGJYaMwpf7DJFMYH:th576H89dfymkG7/sH+DAIzjlmIqNEW6zY3ONrGeAml+k3f1ver399kYnEgG5YCaKXnnVM7P0oJHah80BV3mDw==:1421790376:moul",
"37qBxM4hLV2jfyYo2bNzAjkeLngLr2r7G2HpdpKieVxw:XRmbTYFkPeGVEU2mJzzN4h1oVNDsZ4yyNZlDAfBm9CWhBsZ82QqX9GPHye2hBxxiu4Nz1BHgQiME6B4JcAC8BA==:1421787461:galuel"
],
"joiners":
[
"8Fi1VSTbjkXguwThF4v2ZxC5whK7pwG2vcGTkPUPjPGU:ccJm3F44eLMhQtnQY/7+14SWCDqVTL3Miw65hBVpV+YiUSUknIGhBNN0C0Cf+Pf0/pa1tjucW8Us3z5IklFSDg==:0:DA39A3EE5E6B4B0D3255BFEF95601890AFD80709:1421787800:inso",
"HnFcSms8jzwngtVomTTnzudZx7SHUQY8sVE1y8yBmULk:1lFIiaR0QX0jibr5zQpXVGzBvMGqcsTRlmHiwGz5HOAZT8PTdVUb5q6YGZ6qAUZjdMjPmhLaiMIpYc47wUnzBA==:0:DA39A3EE5E6B4B0D3255BFEF95601890AFD80709:1421786393:cgeek",
"BMAVuMDcGhYAV4wA27DL1VXX2ZARZGJYaMwpf7DJFMYH:ctyAhpTRrAAOhFJukWI8RBr//nqYYdQibVzjOfaCdcWLb3TNFKrNBBothNsq/YrYHr7gKrpoftucf/oxLF8zAg==:0:DA39A3EE5E6B4B0D3255BFEF95601890AFD80709:1421790376:moul",
"37qBxM4hLV2jfyYo2bNzAjkeLngLr2r7G2HpdpKieVxw:uoiGaC5b7kWqtqdPxwatPk9QajZHCNT9rf8/8ud9Rli24z/igcOf0Zr4A6RTAIKWUq9foW39VqJe+Y9R3rhACw==:0:DA39A3EE5E6B4B0D3255BFEF95601890AFD80709:1421787461:galuel"
],
"actives": [ ],
"leavers": [ ],
"excluded": [ ],
"certifications":
[
"37qBxM4hLV2jfyYo2bNzAjkeLngLr2r7G2HpdpKieVxw:8Fi1VSTbjkXguwThF4v2ZxC5whK7pwG2vcGTkPUPjPGU:0:3wmCVW8AbVxRFm2PuLXD9UTCIg93MhUblZJvlYrDldSV4xuA7mZCd8TV4vb/6Bkc0FMQgBdHtpXrQ7dpo20uBA==",
"HnFcSms8jzwngtVomTTnzudZx7SHUQY8sVE1y8yBmULk:8Fi1VSTbjkXguwThF4v2ZxC5whK7pwG2vc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L1VXX2ZARZGJYaMwpf7DJFMYH:0:sZTQJr0d/xQnxrIIdSePUJpSTOa8v6IYGXMF2fVDZxQU8vwfzPm2dUKTaF0nU6E9wOYszzkBHaXL85nir+WtCQ==",
"37qBxM4hLV2jfyYo2bNzAjkeLngLr2r7G2HpdpKieVxw:BMAVuMDcGhYAV4wA27DL1VXX2ZARZGJYaMwpf7DJFMYH:0:hDuBkoFhWhR/FgOU1+9SbQGBMIr47xqUzw1ZMERaPQo4aWm0WFbZurG4lvuJZzTyG6RF/gSw4VPvYZFPxWmADg==",
"8Fi1VSTbjkXguwThF4v2ZxC5whK7pwG2vcGTkPUPjPGU:37qBxM4hLV2jfyYo2bNzAjkeLngLr2r7G2HpdpKieVxw:0:79ZVrBehElVZh82fJdR18IJx06GkEVZTbwdHH4zb0S6VaGwdtLh1rvomm4ukBvUc8r/suTweG/SScsJairXNAg==",
"HnFcSms8jzwngtVomTTnzudZx7SHUQY8sVE1y8yBmULk:37qBxM4hLV2jfyYo2bNzAjkeLngLr2r7G2HpdpKieVxw:0:e/ai9E4G5CFB9Qi329e0ffYpZMgxj8mM4rviqIr2+UESA0UG86OuAAyHO11hYeyolZRiU8I7WdtNE98B1uZuBg==",
"BMAVuMDcGhYAV4wA27DL1VXX2ZARZGJYaMwpf7DJFMYH:37qBxM4hLV2jfyYo2bNzAjkeLngLr2r7G2HpdpKieVxw:0:q4PCneYkcPH8AHEqEvqTtYQWslhlYO2B87aReuOl1uPczn5Q3VkZFAsU48ZTYryeyWp2nxdQojdFYhlAUNchAw=="
],
"transactions": [ ],
"raw": "Version: 1\nType: Block\nCurrency: meta_brouzouf\nNonce: 10144\nNumber: 0\nPoWMin: 3\nTime: 1421838980\nMedianTime: 1421838980\nIssuer: HnFcSms8jzwngtVomTTnzudZx7SHUQY8sVE1y8yBmULk\nParameters: 0.1:86400:100:604800:2629800:3:3:2629800:3:11:600:20:144:0.67\nMembersCount: 4\nIdentities:\n8Fi1VSTbjkXguwThF4v2ZxC5whK7pwG2vcGTkPUPjPGU:Ot3zIp/nsHT3zgJy+2YcXPL6vaM5WFsD+F8w3qnJoBRuBG6lv761zoaExp2iyUnm8fDAyKPpMxRK2kf437QSCw==:1421787800:inso\nHnFcSms8jzwngtVomTTnzudZx7SHUQY8sVE1y8yBmULk:GZKLgaxJKL+GqxVLePMt8OVLJ6qTLrib5Mr/j2gjiNRY2k485YLB2OlzhBzZVnD3xLs0xi69JUfmLnM54j3aCA==:1421786393:cgeek\nBMAVuMDcGhYAV4wA27DL1VXX2ZARZGJYaMwpf7DJFMYH:th576H89dfymkG7/sH+DAIzjlmIqNEW6zY3ONrGeAml+k3f1ver399kYnEgG5YCaKXnnVM7P0oJHah80BV3mDw==:1421790376:moul\n37qBxM4hLV2jfyYo2bNzAjkeLngLr2r7G2HpdpKieVxw:XRmbTYFkPeGVEU2mJzzN4h1oVNDsZ4yyNZlDAfBm9CWhBsZ82QqX9GPHye2hBxxiu4Nz1BHgQiME6B4JcAC8BA==:1421787461:galuel\nJoiners:\n8Fi1VSTbjkXguwThF4v2ZxC5whK7pwG2vcGTkPUPjPGU:ccJm3F44eLMhQtnQY/7+14SWCDqVTL3Miw65hBVpV+YiUSUknIGhBNN0C0Cf+Pf0/pa1tjucW8Us3z5IklFSDg==:0:DA39A3EE5E6B4B0D3255BFEF95601890AFD80709:1421787800:inso\nHnFcSms8jzwngtVomTTnzudZx7SHUQY8sVE1y8yBmULk:1lFIiaR0QX0jibr5zQpXVGzBvMGqcsTRlmHiwGz5HOAZT8PTdVUb5q6YGZ6qAUZjdMjPmhLaiMIpYc47wUnzBA==:0:DA39A3EE5E6B4B0D3255BFEF95601890AFD80709:1421786393:cgeek\nBMAVuMDcGhYAV4wA27DL1VXX2ZARZGJYaMwpf7DJFMYH:ctyAhpTRrAAOhFJukWI8RBr//nqYYdQibVzjOfaCdcWLb3TNFKrNBBothNsq/YrYHr7gKrpoftucf/oxLF8zAg==:0:DA39A3EE5E6B4B0D3255BFEF95601890AFD80709:1421790376:moul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AyHO11hYeyolZRiU8I7WdtNE98B1uZuBg==\nBMAVuMDcGhYAV4wA27DL1VXX2ZARZGJYaMwpf7DJFMYH:37qBxM4hLV2jfyYo2bNzAjkeLngLr2r7G2HpdpKieVxw:0:q4PCneYkcPH8AHEqEvqTtYQWslhlYO2B87aReuOl1uPczn5Q3VkZFAsU48ZTYryeyWp2nxdQojdFYhlAUNchAw==\nTransactions:\n"
}"""
bma_peering = b"""{
"version": 1,
"currency": "meta_brouzouf",
"endpoints":
[
"BASIC_MERKLED_API localhost 0.0.0.0 8000"
],
"status": "UP",
"block": "0-DA39A3EE5E6B4B0D3255BFEF95601890AFD80709",
"signature": "boZBmPJUcL11O+RxiL7nEoxueUObOr7SqZVLFJFbxEeMe9mKgfOmBIZ5ch09s1n0cIx6BFlMbVl0yiy23h31Cw==",
"raw": "Version: 1\nType: Peer\nCurrency: meta_brouzouf\nPublicKey: HnFcSms8jzwngtVomTTnzudZx7SHUQY8sVE1y8yBmULk\nBlock: 0-DA39A3EE5E6B4B0D3255BFEF95601890AFD80709\nEndpoints:\nBASIC_MERKLED_API localhost 0.0.0.0 8000\n",
"pubkey": "HnFcSms8jzwngtVomTTnzudZx7SHUQY8sVE1y8yBmULk"
}"""
def get_mock():
# Assume a running server
# Initialise the mock client and clear all responses
mock = HTTPMock('localhost', 50000)
mock.when('GET /network/peering')\
.reply(body=bma_peering,
times=FOREVER,
headers={'Content-Type': 'application/json'})
# For GET requests to /hello reply with a body of 'Hello'
mock.when('GET /blockchain/Block/0')\
.reply(body=b"Block not found",
status=404,
times=FOREVER,
headers={'Content-Type': 'application/json'})
# For GET requests to /hello reply with a body of 'Hello'
mock.when('GET /blockchain/current')\
.reply(body=b"Block not found",
status=404,
times=FOREVER,
headers={'Content-Type': 'application/json'})
return mock
import sys
import unittest
import os
import asyncio
import quamash
from PyQt5.QtWidgets import QMenu
from PyQt5.QtCore import QLocale
from cutecoin.gui.mainwindow import MainWindow
from cutecoin.core.app import Application
from cutecoin.tests import get_application
class MainWindowMenusTest(unittest.TestCase):
def setUp(self):
self.qapplication = get_application()
QLocale.setDefault(QLocale("en_GB"))
self.lp = quamash.QEventLoop(self.qapplication)
asyncio.set_event_loop(self.lp)
self.application = Application(self.qapplication, self.lp, None, None)
self.main_window = MainWindow(self.application)
def tearDown(self):
try:
self.lp.close()
finally:
asyncio.set_event_loop(None)
def test_menubar(self):
children = self.main_window.menubar.children()
menus = []
""":type: list[QMenu]"""
for child in children:
if isinstance(child, QMenu):
menus.append(child)
self.assertEqual(len(menus), 3)
self.assertEqual(menus[0].objectName(), 'menu_file')
self.assertEqual(menus[1].objectName(), 'menu_account')
self.assertEqual(menus[2].objectName(), 'menu_help')
def test_menu_account(self):
actions = self.main_window.menu_account.actions()
""":type: list[QAction]"""
self.assertEqual('action_configure_parameters', actions[1].objectName())
self.assertEqual('action_add_account', actions[2].objectName())
self.assertEqual('actionCertification', actions[4].objectName())
self.assertEqual('actionTransfer_money', actions[5].objectName())
self.assertEqual('action_add_a_contact', actions[7].objectName())
self.assertEqual(9, len(actions))
def test_menu_actions(self):
actions = self.main_window.menu_help.actions()
""":type: list[QAction]"""
self.assertEqual(len(actions), 1)
self.assertEqual(actions[0].objectName(), 'actionAbout')
if __name__ == '__main__':
unittest.main()
import sys
import unittest
import os
import asyncio
import quamash
import logging
import time
from PyQt5.QtWidgets import QMenu
from PyQt5.QtCore import QLocale, Qt
from PyQt5.QtTest import QTest
from cutecoin.tests.mocks.bma import new_blockchain
from cutecoin.tests.stubs.core.registry.identities import IdentitiesRegistry
from cutecoin.gui.process_cfg_community import ProcessConfigureCommunity
from cutecoin.gui.password_asker import PasswordAskerDialog
from cutecoin.core.app import Application
from cutecoin.core.account import Account
from cutecoin.tests import get_application
class ProcessAddCommunity(unittest.TestCase):
def setUp(self):
self.qapplication = get_application()
QLocale.setDefault(QLocale("en_GB"))
self.lp = quamash.QEventLoop(self.qapplication)
asyncio.set_event_loop(self.lp)
self.application = Application(self.qapplication, self.lp, None, None)
self.identities_registry = IdentitiesRegistry()
self.account = Account("test", "test", "test", [], [], [], self.identities_registry)
self.password_asker = PasswordAskerDialog(self.account)
def tearDown(self):
try:
self.lp.close()
finally:
asyncio.set_event_loop(None)
def test_add_community_empty_blockchain(self):
mock = new_blockchain.get_mock()
self.process_community = ProcessConfigureCommunity(self.application, self.account, None, self.password_asker)
QTest.mouseClick(self.process_community.lineedit_add_address, Qt.LeftButton)
QTest.keyClicks(self.process_community.lineedit_add_address, "localhost")
QTest.mouseDClick(self.process_community.spinbox_add_port, Qt.LeftButton)
self.process_community.spinbox_add_port.setValue(50000)
self.assertEqual(self.process_community.lineedit_add_address.text(), "localhost")
self.assertEqual(self.process_community.spinbox_add_port.value(), 50000)
QTest.mouseClick(self.process_community.button_checknode, Qt.LeftButton)
time.sleep(1)
self.assertEqual(mock.get_request(0).method, 'GET')
self.assertEqual(mock.get_request(0).url, '/network/peering')
self.assertEqual(self.process_community.button_checknode.text(), "Ok !")
if __name__ == '__main__':
logging.basicConfig( stream=sys.stderr )
logging.getLogger().setLevel( logging.DEBUG )
unittest.main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment