From 394ee583bfcc7b3bd49e8a5ebcfd312ba31f8c81 Mon Sep 17 00:00:00 2001 From: shekhar-cis Date: Tue, 28 Sep 2021 19:03:24 +0530 Subject: [PATCH] added pupulate_test_data method --- src/bitmessagekivy/tests/telenium_process.py | 20 +++++++++---------- .../tests/test_create_random_address.py | 15 +++++--------- 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/src/bitmessagekivy/tests/telenium_process.py b/src/bitmessagekivy/tests/telenium_process.py index 85e12c8f..a2dee8b6 100644 --- a/src/bitmessagekivy/tests/telenium_process.py +++ b/src/bitmessagekivy/tests/telenium_process.py @@ -30,15 +30,6 @@ def cleanup(files=_files): pass -def populate_test_data(): - """Set temp data in tmp directory""" - for file_name in tmp_db_file: - old_source_file = os.path.join( - os.path.abspath(os.path.dirname(__file__)), 'sampleData', file_name) - new_destination_file = os.path.join(os.environ['BITMESSAGE_HOME'], file_name) - shutil.copyfile(old_source_file, new_destination_file) - - class TeleniumTestProcess(TeleniumTestCase): """Setting Screen Functionality Testing""" cmd_entrypoint = [os.path.join(os.path.abspath(os.getcwd()), 'src', 'mock', 'kivy_main.py')] @@ -47,9 +38,18 @@ class TeleniumTestProcess(TeleniumTestCase): def setUpClass(cls): """Setupclass is for setting temp environment""" os.environ["BITMESSAGE_HOME"] = tempfile.gettempdir() - populate_test_data() + cls.populate_test_data() super(TeleniumTestProcess, cls).setUpClass() + @classmethod + def populate_test_data(): + """Set temp data in tmp directory""" + for file_name in tmp_db_file: + old_source_file = os.path.join( + os.path.abspath(os.path.dirname(__file__)), 'sampleData', file_name) + new_destination_file = os.path.join(os.environ['BITMESSAGE_HOME'], file_name) + shutil.copyfile(old_source_file, new_destination_file) + @classmethod def tearDownClass(cls): """Ensures that pybitmessage stopped and removes files""" diff --git a/src/bitmessagekivy/tests/test_create_random_address.py b/src/bitmessagekivy/tests/test_create_random_address.py index 750cc9eb..89acd255 100644 --- a/src/bitmessagekivy/tests/test_create_random_address.py +++ b/src/bitmessagekivy/tests/test_create_random_address.py @@ -1,9 +1,7 @@ -import os -import tempfile from random import choice from string import ascii_lowercase from telenium.client import TeleniumHttpException -from .telenium_process import TeleniumTestProcess, cleanup +from .telenium_process import TeleniumTestProcess from .common import skip_screen_checks from .common import ordered @@ -12,10 +10,8 @@ class CreateRandomAddress(TeleniumTestProcess): """This is for testing randrom address creation""" @classmethod - def setUpClass(cls): - os.environ["BITMESSAGE_HOME"] = tempfile.gettempdir() - cleanup() - super(TeleniumTestProcess, cls).setUpClass() + def populate_test_data(cls): + pass @skip_screen_checks @ordered @@ -24,11 +20,10 @@ class CreateRandomAddress(TeleniumTestProcess): # Checking current Screen(Login screen) self.assert_wait_no_except('//ScreenManager[@current]', timeout=15, value='login') # Clicking on Proceed Next Button - self.assertExists('//Screen[0]//MDFillRoundFlatIconButton[@text=\"Proceed Next\"]', timeout=2) + self.assertExists('//Screen[0]//MDFillRoundFlatIconButton[@text=\"Proceed Next\"]', timeout=5) self.cli.wait_click( - '//Screen[0]//MDFillRoundFlatIconButton[@text=\"Proceed Next\"]', timeout=2) + '//Screen[0]//MDFillRoundFlatIconButton[@text=\"Proceed Next\"]', timeout=5) # Checking Current Screen(Random Screen) after Clicking on Proceed Next Button - # self.assertExists("//Random[@name~=\"random\"]", timeout=2) try: self.assertExists("//ScreenManager[@current=\"random\"]", timeout=2) except TeleniumHttpException: