move the BorgQtTestCase into its own file

This commit is contained in:
Andreas Zweili 2019-01-26 11:44:51 +01:00
parent 258d978a02
commit 5e692032fe
2 changed files with 26 additions and 19 deletions

View File

@ -13,28 +13,13 @@ import context
from main_window import MainWindow
from config import Config
from helper import BorgException
from testcase import BorgQtTestCase
app = QApplication(sys.argv)
def fxn():
warnings.warn("deprecated", DeprecationWarning)
class BorgQtConfigTestCase(unittest.TestCase):
def setUp(self):
with warnings.catch_warnings():
warnings.simplefilter("ignore")
fxn()
self.form = MainWindow()
self.dir_path = os.path.dirname(os.path.realpath(__file__))
self.config_path = os.path.join(self.dir_path,
'../docs/borg_qt.conf.example')
class TestConfiguration(BorgQtConfigTestCase):
class TestConfiguration(BorgQtTestCase):
def test_read_configuration(self):
self.form.config._get_path = MagicMock(return_value=self.config_path)
self.form.config.read()
@ -73,7 +58,7 @@ class TestConfiguration(BorgQtConfigTestCase):
os.environ['BORG_PASSPHRASE'])
class TestWriteConfiguration(BorgQtConfigTestCase):
class TestWriteConfiguration(BorgQtTestCase):
def tearDown(self):
if os.path.exists(self.form.config.path):
os.remove(self.form.config.path)
@ -89,7 +74,7 @@ class TestWriteConfiguration(BorgQtConfigTestCase):
config['borgqt']['password'])
class TestGuiConfiguration(BorgQtConfigTestCase):
class TestGuiConfiguration(BorgQtTestCase):
def setUp(self):
super().setUp()
self.form.config.read()

22
tests/testcase.py Normal file
View File

@ -0,0 +1,22 @@
import os
import unittest
import warnings
from main_window import MainWindow
def fxn():
warnings.warn("deprecated", DeprecationWarning)
class BorgQtTestCase(unittest.TestCase):
def setUp(self):
with warnings.catch_warnings():
warnings.simplefilter("ignore")
fxn()
self.form = MainWindow()
self.dir_path = os.path.dirname(os.path.realpath(__file__))
self.config_path = os.path.join(self.dir_path,
'../docs/borg_qt.conf.example')