How to use dumpItems method in fMBT

Best Python code snippet using fMBT_python

test.py

Source:test.py Github

copy

Full Screen

...98 "window=%s}" % saveDlgStr))99 try:100 filesTree = waitForObject("{name='treeWidget' type='QTreeWidget' visible='1' "101 "window=':WritePermissions_Core::Internal::ReadOnlyFilesDialog'}")102 items = map(os.path.expanduser, map(os.path.join, dumpItems(filesTree.model(), column=4),103 dumpItems(filesTree.model(), column=3)))104 difference = set(readOnlyFiles) ^ set(items)105 test.verify(len(difference) == 0, "Verifying whether all modified files without write "106 "permission are listed.")107 clickButton("{text='Change Permission' type='QPushButton' visible='1' unnamed='1' "108 "window=':WritePermissions_Core::Internal::ReadOnlyFilesDialog'}")109 except:110 test.fatal("Missing dialog regarding missing permission on read only files.")111 exitCanceled = False112 try:113 mBoxStr = "{type='QMessageBox' unnamed='1' visible='1' text?='*Could not save the files.'}"114 msgBox = waitForObject(mBoxStr, 3000)115 test.fatal("Creator failed to set permissions.", str(msgBox.text))116 exitCanceled = True117 clickButton(waitForObject("{text='OK' type='QPushButton' unnamed='1' visible='1' "118 "window=%s}" % mBoxStr))119 except:120 for current in readOnlyFiles:121 test.verify(isWritable(current),122 "Checking whether Creator made '%s' writable again." % current)123 if exitCanceled:124 invokeMenuItem("File", "Exit")125 test.log("Exiting without saving.")126 waitForObject(saveDlgStr)127 clickButton(waitForObject("{text='Do not Save' type='QPushButton' unnamed='1' "128 "visible='1' window=%s}" % saveDlgStr))129def checkOpenDocumentsContains(itemName):130 openDocsTreeViewModel = waitForObject(":OpenDocuments_Widget").model()131 result = None132 found = False133 for index in dumpIndices(openDocsTreeViewModel):134 if str(index.data()) == itemName:135 found = True136 result = index.toolTip137 break138 test.verify(found, "Check whether 'Open Documents' contains '%s'" % itemName)139 return result140def checkUnsavedChangesContains(model, filePaths):141 foundItems = map(lambda x: os.path.join(x[0], x[1]), zip(dumpItems(model,column=1),142 dumpItems(model, column=0)))143 test.compare(set(foundItems), set(filePaths),144 "Verifying whether modified (unsaved) files do match expected.")145def cleanup():146 global testFolder147 if testFolder:...

Full Screen

Full Screen

data_access_test.py

Source:data_access_test.py Github

copy

Full Screen

...64 name="tovar",65 description="desc",66 price=300,67 )68 DataAccess.dumpItems({1: item_to_dump})69 with open(items_file, 'rb') as f:70 self.assertEqual({1: item_to_dump}, pickle.load(f))71 os.remove(items_file)72 @patch('app.data.data_access.getItemsFile')73 def test_dump_multiple(self, getItemsFileMock: Mock):74 items_file = "tests/items.pickle"75 getItemsFileMock.return_value = items_file76 item_to_dump_1 = Item(77 id=1,78 name="tovar",79 description="desc",80 price=300,81 )82 item_to_dump_2 = Item(83 id=2,84 name="another",85 description="desc2",86 price=400,87 )88 item_to_dump_3 = Item(89 id=3,90 name="third",91 description="desc3",92 price=99.9,93 )94 DataAccess.dumpItems(95 {1: item_to_dump_1, 2: item_to_dump_2, 3: item_to_dump_3})96 with open(items_file, 'rb') as f:97 self.assertEqual(98 {1: item_to_dump_1, 2: item_to_dump_2, 3: item_to_dump_3}, pickle.load(f))99 os.remove(items_file)100 @patch('app.data.data_access.getItemsFile')101 def test_dump_and_load(self, getItemsFileMock: Mock):102 items_file = "tests/items.pickle"103 getItemsFileMock.return_value = items_file104 item_to_dump_and_load = Item(105 id=1,106 name="tovar",107 description="desc",108 price=300,109 )110 DataAccess.dumpItems({1: item_to_dump_and_load})111 self.assertEqual({1: item_to_dump_and_load}, (DataAccess.loadItems()))...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run fMBT automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful