tests update, added program version string

This commit is contained in:
ingvar1995 2016-02-21 23:25:37 +03:00
parent ae3e84e3d2
commit 8dae4fcad9
3 changed files with 26 additions and 4 deletions

View File

@ -44,6 +44,7 @@ class MainWindow(QtGui.QMainWindow):
self.menuSettings.addAction(self.actionNotifications) self.menuSettings.addAction(self.actionNotifications)
self.menuSettings.addAction(self.actionNetwork) self.menuSettings.addAction(self.actionNetwork)
self.menuAbout.addAction(self.actionAbout_program) self.menuAbout.addAction(self.actionAbout_program)
self.actionAbout_program.triggered.connect(self.about_program)
self.menubar.addAction(self.menuProfile.menuAction()) self.menubar.addAction(self.menuProfile.menuAction())
self.menubar.addAction(self.menuSettings.menuAction()) self.menubar.addAction(self.menuSettings.menuAction())
self.menubar.addAction(self.menuAbout.menuAction()) self.menubar.addAction(self.menuAbout.menuAction())
@ -61,6 +62,13 @@ class MainWindow(QtGui.QMainWindow):
self.actionSettings.setText(QtGui.QApplication.translate("MainWindow", "Settings", None, QtGui.QApplication.UnicodeUTF8)) self.actionSettings.setText(QtGui.QApplication.translate("MainWindow", "Settings", None, QtGui.QApplication.UnicodeUTF8))
QtCore.QMetaObject.connectSlotsByName(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow)
def about_program(self):
import util
msgBox = QtGui.QMessageBox()
msgBox.setWindowTitle("About")
msgBox.setText("Toxygen is pythonic Tox client. Version: " + util.program_version)
msgBox.exec_()
def setup_right_bottom(self, Form): def setup_right_bottom(self, Form):
Form.setObjectName("right_bottom") Form.setObjectName("right_bottom")
Form.resize(500, 150) Form.resize(500, 150)

View File

@ -1,12 +1,15 @@
program_version = '0.0.1 (alpha)'
def log(data): def log(data):
with open("logs.log", "a") as fl: with open('logs.log', 'a') as fl:
fl.write(str(data)) fl.write(str(data))
def string_to_bin(tox_id): def string_to_bin(tox_id):
return tox_id.decode("hex") return tox_id.decode('hex')
def bin_to_string(raw_id): def bin_to_string(raw_id):

View File

@ -1,7 +1,7 @@
from src.settings import Settings from src.settings import Settings
from src.tox import Tox
from src.util import bin_to_string, string_to_bin from src.util import bin_to_string, string_to_bin
import sys import sys
from src.bootstrap import node_generator
from src.profile import Profile from src.profile import Profile
import os import os
@ -44,3 +44,14 @@ class TestUtils():
data = string_to_bin(id) data = string_to_bin(id)
new_id = bin_to_string(data) new_id = bin_to_string(data)
assert id == new_id assert id == new_id
class TestNodeGen():
def test_generator(self):
for elem in node_generator():
assert len(elem) == 3
def test_ports(self):
for elem in node_generator():
assert elem[1] in [33445, 443, 5190, 2306, 1813]