def test(self): st = self._getstat("/dir/file") self.assertSomeMsgQueuedAllPorts() self.assertEqual(st, self._getstat("/dir/file")) self.assertNoMsgQueuedAllPorts() f = self._open("/dir/file") f.readlines() f.close() self.assertSomeMsgQueued(self.source_memfs_inport) self.assertSomeMsgQueued(self.cache_memfs_inport) time.sleep(0.5) with locked(self.timeController): self.moxConfig.UnsetStubs() self.moxConfig.StubOutWithMock(self.timeController, "_timeImpl") newTime = self.initialTimeValue + self.cfg.cache_manager.memory_cache_lifetime + 1 self.assertTrue(newTime - self.initialTimeValue < self.cfg.cache_manager.disk_cache_lifetime) self.timeController._timeImpl().MultipleTimes().AndReturn(newTime) self.moxConfig.ReplayAll() self._getstat("/dir/file") self.assertEqual([], TestHelper.fetch_all(self.source_memfs_inport)) self.assertNotEqual([], TestHelper.fetch_all(self.cache_memfs_inport)) dirlist = self._listdir("/dir") self.assertEqual(set(['file', 'file2']), set(dirlist)) self.assertEqual([], TestHelper.fetch_all(self.source_memfs_inport)) self.assertNotEqual([], TestHelper.fetch_all(self.cache_memfs_inport))
def cleanupWorkspaceImpl(self): # additional task to have permission to cleanup TestHelper.execute_source( self.cfg, ''' chmod +rwx -R . ''') CachefsSystemTest.cleanupWorkspaceImpl(self)
def precondition(self): TestHelper.execute_source(self.cfg, ''' mkdir dir echo "Dummy content" >> dir/file echo "Dummy content of file 2" >> dir/file2 ln -s dir/file link ''')
def test_get_file_versions(self): """Test case for get_file_versions Get the file's versions list """ # Prepare file_name = "test_file.docx" src = TestHelper.get_local_folder() + "/" + file_name dst = TestHelper.get_folder() + "/" + file_name res = self.api.upload_file(dst, src) self.assertTrue(len(res.uploaded) == 1) self.assertTrue(len(res.errors) == 0) res = self.api.upload_file(dst, src) self.assertTrue(len(res.uploaded) == 1) self.assertTrue(len(res.errors) == 0) res = self.api.upload_file(dst, src) self.assertTrue(len(res.uploaded) == 1) self.assertTrue(len(res.errors) == 0) res = self.api.get_file_versions(dst) self.assertTrue(isinstance(res.value, list)) dictionary = res.to_dict() self.assertTrue(isinstance(dictionary, dict))
def test_averages(self): sleep_wake_performance_1 = SleepWakePerformance( accuracy=0, wake_correct=0.1, sleep_correct=0.2, auc=0.3, kappa=0.4, wake_predictive_value=0.5, sleep_predictive_value=0.6) sleep_wake_performance_2 = SleepWakePerformance( accuracy=0.2, wake_correct=0.3, sleep_correct=0.4, auc=0.5, kappa=0.6, wake_predictive_value=0.7, sleep_predictive_value=0.8) expected_performance = SleepWakePerformance(accuracy=0.1, wake_correct=0.2, sleep_correct=0.3, auc=0.4, kappa=0.5, wake_predictive_value=0.6, sleep_predictive_value=0.7) performance_list = [sleep_wake_performance_1, sleep_wake_performance_2] actual_averaged_performance = PerformanceSummarizer.average( performance_list) TestHelper.assert_models_equal(self, expected_performance, actual_averaged_performance)
def open_backup(path, flex_is_open): # Opening: Get to the 'Restore a Project' screen ################ helper = TestHelper("open_flex_from_backup") if flex_is_open: helper.Click(Pattern("File.png").similar(0.90), "Couldn't find 'File'") helper.Click("ProjectManag.png", "Couldn't find 'Project Management' in File menu") helper.Click("RestoreaProj.png", "Couldn't find 'Restore a Project...' option") else: # Not sure if this line is needed... #subprocess.Popen("fieldworks-flex &") helper.Click(Pattern("Restoreaproj.png").similar(0.89), "Couldn't find 'Restore a project from a backup file...'") # Goal: Find the backup ################# if not helper.Click(Pattern("Anotherlocat.png").similar(0.80).targetOffset(-48,1), "Couldn't find 'Another location' option", give_up=False): close_box() if not helper.Click(Pattern("Browse.png").similar(0.90), "Couldn't find 'Browse...' button", give_up=False): close_box() helper.Click("1436284725146.png", "Couldn't find button to type a file name", restart=True) paste(path) helper.Type(Key.ENTER) helper.Click(Pattern("OK.png").similar(0.91), "Couldn't click 'OK'", restart=True) if exists(Pattern("7ReplaceExls.png").similar(0.88)): helper.Click(Pattern("Yes.png").similar(0.95), "Couldn't click 'Yes'", time=60, restart=True) helper.write("Successfully opened project: " + path.split("/")[-1]) else: helper.write("Successfully opened project: " + path.split("/")[-1]) wait(40)
def check_word(word, compare_path): helper = TestHelper("check_lexicon_entry_change") set_flex_helper(helper) # Opening ############### helper.Click("Lexicon.png", "Couldn't find 'Lexicon' button") LEFT_SIDEBAR.Click("LexiconEdit.png", "Couldn't find 'Lexicon Edit' button", time=10) helper.Click(Pattern("LexemeForm.png").targetOffset(-52,23), "'Lexeme Form' column not found") helper.Click("lterfor.png", "'Filter for' button not found") paste(word) # Now the 'Filter for' box is up, so if we can't click something # we should restart Flex helper.Click(Pattern("W_holeitem.png").targetOffset(-42,0), "'Whole item' option not found", restart=True) helper.Click(Pattern("OK-1.png").similar(0.85), "OK button not found", time=10, restart=True) # 'Filter for' box is gone now, word should be selected automatically # Create a region inside the 'Entry' panel entry_header = helper.Find("9EntryHShowH.png", "'Entry' field not found in right panel") entry_region = entry_header.below() # Goal ############### if entry_region.exists(Pattern(compare_path).similar(0.9)): helper.write("'" + word + "' field looks the same as in provided image") else: helper.write("'" + word + "' field has changed")
def precondition(self): TestHelper.execute_source(self.cfg, ''' mkdir i echo 'dummy content' >> i/2.txt chmod ugo+rwx i/2.txt ln -s i/2.txt 2.txt ''')
def test_object_exists(self): """Test case for object_exists Check if a specific file or folder exists """ exist_folder = TestHelper.get_folder() res = self.api.object_exists(exist_folder) res = res.to_dict() self.assertTrue('exists' in res) self.assertTrue('is_folder' in res) self.assertTrue(isinstance(res['exists'], bool)) self.assertTrue(isinstance(res['is_folder'], bool)) self.assertTrue(res['exists']) self.assertTrue(res['is_folder']) non_exist_file = TestHelper.get_folder() + 'non_exist_file.gif' res = self.api.object_exists(non_exist_file) res = res.to_dict() self.assertFalse(res['exists']) self.assertFalse(res['is_folder'])
def test_move_file(self): """Test case for move_file Move a specific file """ file_name = "test_file.docx" src = TestHelper.get_local_folder() + "/" + file_name remote_src = TestHelper.get_folder() + "/" + file_name # Put to the storage res = self.api.upload_file(remote_src, src) self.assertTrue(len(res.uploaded) == 1) self.assertTrue(len(res.errors) == 0) remote_dst = TestHelper.get_folder() + "/" + "test_file.docx" # Move in the storage self.api.move_file(remote_src, remote_dst) # Test dst file exist res = self.api.object_exists(remote_dst) self.assertTrue(res.exists) self.assertFalse(res.is_folder) # Test src file not exist res = self.api.object_exists(remote_src) self.assertFalse(res.exists) self.assertFalse(res.is_folder) # clear dst files self.api.delete_file(remote_dst)
def precondition(self): TestHelper.execute_source( self.cfg, ''' mkdir i echo 'dummy content' >> i/2.txt chmod ugo+rwx i/2.txt ln -s i/2.txt 2.txt ''')
def precondition(self): TestHelper.execute_source( self.cfg, ''' mkdir dir echo "Dummy content" >> dir/file echo "Dummy content of file 2" >> dir/file2 ln -s dir/file link ''')
def restart_flex(): helper = TestHelper("restart_flex") helper.write("restarting flex") helper.Type("t", KeyModifier.CTRL | KeyModifier.ALT, time=5) helper.Type("sudo /home/vagrant/Integration-Testing-Framework/sikuli/examples/restart_flex.sh && exit" + Key.ENTER) # If the 'hello' project shows up as the last opened project, # just press enter if helper.Exists(Pattern("iii3iuE.png").similar(0.90), "'hello' project not showing as last opened, " + "trying to open via 'Open a project'", give_up=False): helper.write("Success") helper.Type(Key.ENTER, time=20) # If not, try to find it in the 'Open project screen' else: helper.Click("Openaproject.png", "Couldn't find 'Open a project' button") hello = helper.Find(Pattern("hello.png").similar(0.90), "'hello' project not found in the 'Open Project'" + "screen, trying to create a new project", give_up=False) if hello: helper.DoubleClick(hello, "Found 'hello' but didn't manage to click it, wat!?", time=20) helper.write("Success") # As a last resort, try to create the project (this shouldn't happen # and will probably not work: green screen if hello already exists.) else: helper.write_fail("'hello' project not found, quitting.") exit() wait(2)
def test(self): self._getstat("/dir/file") self.assertNotEqual([], TestHelper.fetch_all(self.source_memfs_inport)) self._getstat("/") self._getstat("/dir") self._getstat("/dir/file") self.assertEqual([], TestHelper.fetch_all(self.source_memfs_inport)) # TODO '''
def setUp(self): cfg = TestHelper.get_cfg() tests_root = cfg.ut_tests_root testcase_current = cfg.ut_current_tc tc_wdir = self.__test_dir = os.sep.join([tests_root, self.__class__.__name__]) os.makedirs(tc_wdir) if (os.path.lexists(testcase_current)): os.unlink(testcase_current) os.symlink(tc_wdir, testcase_current) TestHelper.create_source_dir(cfg.cache_manager) return self.setUpImpl()
def setUp(self): cfg = TestHelper.get_cfg() tests_root = cfg.ut_tests_root testcase_current = cfg.ut_current_tc tc_wdir = self.__test_dir = os.sep.join( [tests_root, self.__class__.__name__]) os.makedirs(tc_wdir) if (os.path.lexists(testcase_current)): os.unlink(testcase_current) os.symlink(tc_wdir, testcase_current) TestHelper.create_source_dir(cfg.cache_manager) return self.setUpImpl()
def check_text(text, compare_path): # Opening ############### helper = TestHelper("check_text_change") set_flex_helper(helper) helper.Click("TUTextsWord.png", "Couldn't find 'Texts & Words' button") LEFT_SIDEBAR.Click("InterlinearT.png", "Couldn't find 'Interlinear Texts' button") # Find the menu to search for text column_menu = helper.Find("Show.png", "Couldn't find 'Show All'") column_menu = Regionplus(helper, column_menu.right()) if not column_menu.Click(Pattern("1436391324903.png").similar(0.90), "Couldn't find arrow for drop-down menu, trying to expand column", give_up=False): # Click on hopefully a different test, so the view of our text will reset helper.Click(Pattern("Show.png").targetOffset(0, 30), "Couldn't find 'Show All'", time=3) # Drag out the column so the arrow is visible while not column_menu.exists(Pattern("1436391324903.png").similar(0.90)): drag_point = helper.Find(Pattern("1436455824256.png").targetOffset(8,0), "Couldn't find point to drag out column", time=2) drop_point = helper.Find(Pattern("Title.png").similar(0.90), "Couldn't find 'Title'") dragDrop(drag_point, drop_point) # Click the arrow column_menu.Click(Pattern("1436391324903.png").similar(0.90), "Couldn't find arrow for drop-down menu even after expanding column") helper.Click("lterfor.png", "'Filter for' button not found") paste(text) # Now the 'Filter for' box is up, so if we can't click something # we should restart Flex helper.Click(Pattern("W_holeitem.png").targetOffset(-42,0), "'Whole item' option not found", restart=True) helper.Click(Pattern("OK-1.png").similar(0.85), "OK button not found", time=10, restart=True) # 'Filter for' box is gone now, text should be selected automatically # Create a region inside the 'Entry' panel text_header = helper.Find("1436391807956.png", "'Text' field not found in right panel") text_region = Regionplus(helper, text_header.below()) text_region.Click("PrintView.png", " Couldn't find 'Print View' tab") # Goal ############### if text_region.exists(Pattern(compare_path).similar(0.9)): helper.write("'" + text + "' print view looks the same as in provided image") else: helper.write("'" + text + "' print view has changed")
def mount_cachefs(self): self.timeModule = mocks.time_mock.ModuleInterface() self.timeController = self.timeModule.getController() self.moxConfig.StubOutWithMock(self.timeController, "_timeImpl") self.timeController._timeImpl().MultipleTimes().AndReturn(self.initialTimeValue) self.moxConfig.ReplayAll() os.symlink(os.path.join(config.getProjectRoot(), 'tests', 'mocks'), os.path.join(config.getProjectRoot(), 'mocks')) CachefsSystemTest.mount_cachefs(self) TestHelper.fetch_all(self.source_memfs_inport) TestHelper.fetch_all(self.cache_memfs_inport)
def precondition(self): TestHelper.execute_source(self.cfg, ''' mkdir -p a/b/c mkdir -p e/f/g touch e/f/g/1.txt mkdir -p i/f/g touch i/f/g/2.txt ln -s ../../../i/f/g e/f/g/j ln -s a b ln -s ../../../i/f/g/2.txt e/f/g/link_to_e ''')
def precondition(self): TestHelper.execute_source( self.cfg, ''' mkdir -p a/b/c mkdir -p e/f/g touch e/f/g/1.txt mkdir -p i/f/g touch i/f/g/2.txt ln -s ../../../i/f/g e/f/g/j ln -s a b ln -s ../../../i/f/g/2.txt e/f/g/link_to_e ''')
def mount_cachefs(self): self.timeModule = mocks.time_mock.ModuleInterface() self.timeController = self.timeModule.getController() self.moxConfig.StubOutWithMock(self.timeController, "_timeImpl") self.timeController._timeImpl().MultipleTimes().AndReturn( self.initialTimeValue) self.moxConfig.ReplayAll() os.symlink(os.path.join(config.getProjectRoot(), 'tests', 'mocks'), os.path.join(config.getProjectRoot(), 'mocks')) CachefsSystemTest.mount_cachefs(self) TestHelper.fetch_all(self.source_memfs_inport) TestHelper.fetch_all(self.cache_memfs_inport)
def __init__(self, *args, **kw): try: cache_via_memfs = kw['cache_via_memfs'] del kw['cache_via_memfs'] except KeyError: cache_via_memfs = False try: source_via_memfs = kw['source_via_memfs'] del kw['source_via_memfs'] except KeyError: source_via_memfs = False ModuleTestCase.__init__(self, *args, **kw) self.cfg = TestHelper.get_cfg() self.tag = 0 # used for testcases with reboot scenario self.cache_memfs = cache_via_memfs self.source_memfs = source_via_memfs if self.cache_memfs: self.cache_memfs_inport = None # must be initialized after port creation in test suite self.cache_memfs_mounter = None if self.source_memfs: self.source_memfs_inport = None # must be initialized after port creation in test suite self.source_memfs_mounter = None
def test_delete_file(self): """Test case for delete_file Remove a specific file """ # upload file to storage file_name = "test_file.docx" src = TestHelper.get_local_folder() + "/" + file_name dst = TestHelper.get_folder() + "/" + file_name res = self.api.upload_file(dst, src) self.assertTrue(len(res.uploaded) == 1) self.assertTrue(len(res.errors) == 0) # delete file in the storage self.api.delete_file(dst)
def test_upload_file(self): """Test case for upload_file Upload a specific file """ file_name = "test_file.docx" src = TestHelper.get_local_folder() + "/" + file_name dst = TestHelper.get_folder() + "/" + file_name result = self.api.upload_file(dst, src) self.assertTrue(len(result.uploaded) == 1) self.assertTrue(len(result.errors) == 0) # check file exists res = self.api.object_exists(dst) res = res.to_dict() self.assertTrue(res['exists']) self.assertFalse(res['is_folder'])
def precondition(self): #sshcfg = self.cfg.ssh cls = TestDirectoriesAndFiles cfg = self.cfg.cache_manager TestHelper.create_source_file(cfg, cls.FILE_1, cls.FILE_1_CONTENT) TestHelper.create_source_dir(cfg, cls.SUBDIR_1) TestHelper.create_source_file(cfg, cls.FILE_2_SUBPATH, cls.FILE_2_CONTENT)
def precondition(self): cfg = self.cfg.cache_manager TestHelper.create_source_dir(cfg, TestDirectoriesOnly.SUBDIR_1) TestHelper.create_source_dir(cfg, TestDirectoriesOnly.SUBDIR_2) TestHelper.create_source_dir(cfg, os.sep.join([TestDirectoriesOnly.SUBDIR_2, TestDirectoriesOnly.SUB_SUBDIR_2]))
def test(self): dir_path = "/TestCacheManager.test_listDir" cfg = self.cfg.cache_manager TestHelper.create_source_dir(cfg, dir_path) subdir_name = 'subdir' dir_path2 = os.sep.join([dir_path, subdir_name]) TestHelper.create_source_dir(cfg, dir_path2) file_name = '1.txt' file_path = os.sep.join([dir_path, file_name]) TestHelper.create_source_file(cfg, file_path, 'file_content ... ') self.assertTrue(self.sut.exists(dir_path)) #precond: self.sut.getAttributes(dir_path) listDir_out = self.sut.listDirectory(dir_path) input = [file_name, subdir_name] self.assertEqual(sorted(input), sorted(listDir_out)) cache_root_path = self.sut._cfg.cache_root_dir cache_dir_walker = disk_cache.CachedDirWalker(cache_root_path) path_transformer = path_factory.PathTransformer() cached_subdir_path = os.sep.join( [cache_root_path, dir_path, path_transformer.transformDirpath(subdir_name)]) self.assertTrue(os.path.exists(cached_subdir_path)) cached_file_path = os.sep.join( [cache_root_path, path_transformer.transformFilepath(file_name)]) self.assertFalse(os.path.exists(cached_file_path))
def setUpClass(cls): # Get the display name prompt out of the way # (it is tested in another class) TestHelper.setup_with_new_displayname() # and create new channels TestHelper.create_new_channel("Csepűrágó1") time.sleep(1) TestHelper.create_new_channel("Csepűrágó2")
def check_dictionary(compare_path): # Opening ################ helper = TestHelper("check_dictionary_change") set_flex_helper(helper) helper.Click("Lexicon.png", "Couldn't find 'Lexicon' button") # First make sure all entries are showing LEFT_SIDEBAR.Click("LexiconEdit.png", "Couldn't find 'Lexicon Edit' button", time=10) if not exists(Pattern("ieadwordShow.png").similar(0.90)): helper.Click(Pattern("LexemeForm.png").targetOffset(-52,23), "'Lexeme Form' column not found") helper.Click(Pattern("Headword-1.png").similar(0.90).targetOffset(0,50), "Couldn't find 'Headword'", time=15) LEFT_SIDEBAR.Click("ElDictionary.png", "Couldn't find 'Dictionary' button", time=20) # Goal ################# TOOLBARS.Click("1436456695019.png", "Couldn't find 'First' button -- may already be at start", give_up=False) if exists(Pattern(compare_path).similar(0.9)): helper.write("Dictionary looks the same as in provided image") else: helper.write("Dictionary print view has changed")
def precondition(self): cfg = self.cfg.cache_manager TestHelper.create_source_dir(cfg, TestDirectoriesOnly.SUBDIR_1) TestHelper.create_source_dir(cfg, TestDirectoriesOnly.SUBDIR_2) TestHelper.create_source_dir( cfg, os.sep.join([ TestDirectoriesOnly.SUBDIR_2, TestDirectoriesOnly.SUB_SUBDIR_2 ]))
def test_get_files_list(self): """Test case for get_files_list Get the file listing of a specific folder """ folder = TestHelper.get_folder() res = self.api.get_files_list(folder) self.assertTrue(isinstance(res.value, list)) one_file = res.value[0] self.assertTrue(isinstance(one_file.name, str)) self.assertTrue(isinstance(one_file.is_folder, bool)) self.assertTrue(isinstance(one_file.modified_date, datetime.datetime)) self.assertTrue(isinstance(one_file.size, int)) self.assertTrue(isinstance(one_file.path, str))
def test_leave_one_out(self): subject_ids = ["subjectA", "subjectB", "subjectC"] results = TrainTestSplitter.leave_one_out(subject_ids) TestHelper.assert_models_equal( self, DataSplit(training_set=["subjectB", "subjectC"], testing_set=["subjectA"]), results[0]) TestHelper.assert_models_equal( self, DataSplit(training_set=["subjectA", "subjectC"], testing_set=["subjectB"]), results[1]) TestHelper.assert_models_equal( self, DataSplit(training_set=["subjectA", "subjectB"], testing_set=["subjectC"]), results[2])
def test_download_file(self): """Test case for download_file Download a specific file """ file_name = "test_file.docx" size = TestHelper.get_file_size(file_name) # put file to storage res = TestHelper.upload_file(file_name) self.assertTrue(len(res.uploaded) == 1) self.assertTrue(len(res.errors) == 0) download_file = TestHelper.get_folder() + "/" + file_name save_file = TestHelper.get_local_dest_folder() + "/" + "test_file.docx" src = self.api.download_file(download_file) TestHelper.move_file(src, save_file) self.assertTrue(os.path.getsize(save_file) == size)
def test(self): dir_path = "/TestCacheManager.test_listDir" cfg = self.cfg.cache_manager TestHelper.create_source_dir(cfg, dir_path) subdir_name = 'subdir' dir_path2 = os.sep.join([dir_path, subdir_name]) TestHelper.create_source_dir(cfg, dir_path2) file_name = '1.txt' file_path = os.sep.join([dir_path, file_name]) TestHelper.create_source_file(cfg, file_path, 'file_content ... ') self.assertTrue(self.sut.exists(dir_path)) #precond: self.sut.getAttributes(dir_path) listDir_out = self.sut.listDirectory(dir_path) input = [file_name, subdir_name] self.assertEqual(sorted(input), sorted(listDir_out)) cache_root_path = self.sut._cfg.cache_root_dir cache_dir_walker = disk_cache.CachedDirWalker(cache_root_path) path_transformer = path_factory.PathTransformer() cached_subdir_path = os.sep.join([ cache_root_path, dir_path, path_transformer.transformDirpath(subdir_name) ]) self.assertTrue(os.path.exists(cached_subdir_path)) cached_file_path = os.sep.join( [cache_root_path, path_transformer.transformFilepath(file_name)]) self.assertFalse(os.path.exists(cached_file_path))
def __init__(self, *args): TestHelper.__init__(self, *args) self.code32 = "\x8d\x4c\x32\x08\x01\xd8\x81\xc6\x34\x12\x00\x00\x05\x23\x01\x00\x00\x36\x8b\x84\x91\x23\x01\x00\x00\x41\x8d\x84\x39\x89\x67\x00\x00\x8d\x87\x89\x67\x00\x00\xb4\xc6" self.code64 = "\x55\x48\x8b\x05\xb8\x13\x00\x00"
def cleanupWorkspaceImpl(self): # additional task to have permission to cleanup TestHelper.execute_source(self.cfg, ''' chmod +rwx -R . ''') CachefsSystemTest.cleanupWorkspaceImpl(self)
def cleanupWorkspaceImpl(self): TestHelper.remove_source_dir(self.cfg.cache_manager) shutil.rmtree(self.sut._cfg.cache_root_dir)
def cleanupWorkspace(self): self.cleanupWorkspaceImpl() shutil.rmtree(self.__test_dir) cfg = TestHelper.get_cfg() os.remove(cfg.ut_current_tc)
def setUpImpl(self): cachefs.memory_cache.time = time self.cfg = TestHelper.get_cfg() self.sut = cachefs.CacheManager(self.cfg.cache_manager)
def precondition(self): cfg = self.cfg.cache_manager cls = RelativePaths TestHelper.create_source_dir(cfg, cls.SUBDIR) TestHelper.create_source_file(cfg, cls.FILE, cls.FILE_CONTENT) TestHelper.create_source_dir(cfg, cls.SUBDIR_2) TestHelper.create_source_file(cfg, cls.FILE_2, cls.FILE_CONTENT_2) TestHelper.create_source_dir(cfg, cls.SUBDIR_3) TestHelper.create_source_file(cfg, cls.FILE_3, cls.FILE_CONTENT_3)
def create_file(permissions): TestHelper.execute_source(self.cfg, ''' touch {pmss:o} chmod {pmss:o} {pmss:o} '''.format( pmss=permissions)) # x:o - i.e. x converted to oct format
def create_dir(permissions): TestHelper.execute_source(self.cfg, ''' mkdir {pmss:o}_dir chmod {pmss:o} {pmss:o}_dir '''.format( pmss=permissions)) # x:o - i.e. x converted to oct format
def precondition(self): cls = TestBigFilesWithContent cls.FILE_CONTENT = ":-)" * cls.FILE_SIZE # 3 * 16Mb TestHelper.create_source_file(self.cfg.cache_manager, cls.FILE_PATH, cls.FILE_CONTENT)
def setUp(self): cachefs.memory_cache.time = time # FIXME: self.sut = cachefs.CacheFs() self.sut.cfg = TestHelper.get_cfg()
def test(self): file_path = '/TestCacheManager.test_exists.txt' TestHelper.create_source_file(self.cfg.cache_manager, file_path, '.' * 5) self.assertTrue(self.sut.exists(file_path))
def create_dir(permissions): TestHelper.execute_source(self.cfg, ''' mkdir {pmss:o}_dir chmod {pmss:o} {pmss:o}_dir '''.format(pmss = permissions)) # x:o - i.e. x converted to oct format
def assertSomeMsgQueued(self, port): self.assertNotEqual([], TestHelper.fetch_all(port))
from sikuli import * from flex_regions import * from test_helper import TestHelper """ Click through all of the buttons in the left sidebar on the Lexicon screen. Make sure the middle part of the screen changes within 5 seconds. If an information box pops up, close it. Return to first option when done. """ # Setup helper = TestHelper("try_all_side_bar_buttons") set_flex_helper(helper) def stop_observer(event): global changed changed = True event.region.stopObserver() if Region(148,139,544,545).exists("information_popup.png"): helper.Type(Key.ENTER, time=5) # Opening ############### helper.Click("Lexicon.png", "Couldn't find 'Lexicon' button") first_region = Region(21,127,115,15) click(first_region.getCenter())
def create_file(permissions): TestHelper.execute_source(self.cfg, ''' touch {pmss:o} chmod {pmss:o} {pmss:o} '''.format(pmss = permissions)) # x:o - i.e. x converted to oct format
import sys sys.path.insert(0, '/home/vagrant/Integration-Testing-Framework/sikuli/examples') from sikuli import * from test_helper import TestHelper from flex_regions import * from Regionplus import * # Setup helper = TestHelper("drag_column") set_flex_helper(helper) # Opening ############# helper.Click("Lexicon.png", "Couldn't find 'Lexicon' button") LEFT_SIDEBAR.Click("LexiconEdit.png", "Couldn't find 'Lexicon Edit' button") # Goal ############# # Not doing the drag-drop directly, so if it fails we can # pinpoint what wasn't found glosses = MID_TOOLBAR.Find("3losses.png", "Couldn't find 'Glosses' column header") target = MID_TOOLBAR.Find("lLexemeJorm_.png", "'Headword' and 'Lexeme Form' headers not where expected") dragDrop(glosses, target) # Check that it's in the new position helper.Find(Pattern("hexemeformHe.png").similar(0.80), "'Glosses' column not in new position") # Closing