def test_all_plugins_snapshot(self): tmpdir = tempfile.mkdtemp(prefix="citellus-tmp") tmpdir2 = tempfile.mkdtemp(prefix="citellus-tmp") # Setup folder for all tests testtype = "pass" for test in uttest: subprocess.call([test["plugin"], test["plugin"], testtype, tmpdir]) subprocess.call( [test["plugin"], test["plugin"], testtype, tmpdir2]) # Run citellus once against them results = citellus.docitellus( path=tmpdir, plugins=citplugs, okay=okay, failed=failed, skipped=skipped, info=info, web=True, ) maguiresults = magui.domagui(sosreports=[tmpdir, tmpdir2], citellusplugins=citplugs) # Check that citellus.html has been copied assert os.access(os.path.join(tmpdir, "citellus.json"), os.R_OK) assert os.access(os.path.join(tmpdir, "citellus.html"), os.R_OK) assert maguiresults # Remove tmp folder shutil.rmtree(tmpdir) shutil.rmtree(tmpdir2) # Process plugin output from multiple plugins new_dict = [] out_dict = [] for item in results: rc = results[item]["result"]["rc"] if rc not in sorted({okay, failed, skipped, info}): print(results[item]) assert rc in sorted({okay, failed, skipped, info}) if rc == failed or rc == skipped: print(results[item]) assert results[item]["result"]["err"] != "" new_dict.append(rc) if results[item]["result"]["out"] != "": print(results[item]) assert results[item]["result"]["out"] == "" out_dict.append(results[item]["result"]["out"]) for each in sorted(set(new_dict)): assert each in sorted({okay, failed, skipped, info})
def test_domagui_againstjsons(self): print("Running magui against set of jsons, might take a while...") # Find all jsons mypath = os.path.dirname(__file__) alljsons = citellus.findplugins(folders=[mypath], executables=False, fileextension=".json") jsons = [] # Convert from plugin list to json list for jsonfile in alljsons: jsons.append(jsonfile["plugin"]) # Call with no arguments res = magui.domagui(sosreports=jsons, citellusplugins=[]) assert res != {}
def test_all_plugins_snapshot(self): tmpdir = tempfile.mkdtemp(prefix='citellus-tmp') tmpdir2 = tempfile.mkdtemp(prefix='citellus-tmp') # Setup folder for all tests testtype = 'pass' for test in uttest: subprocess.call([test['plugin'], test['plugin'], testtype, tmpdir]) subprocess.call([test['plugin'], test['plugin'], testtype, tmpdir2]) # Run citellus once against them results = citellus.docitellus(path=tmpdir, plugins=citplugs, okay=okay, failed=failed, skipped=skipped, web=True) maguiresults = magui.domagui(sosreports=[tmpdir, tmpdir2], citellusplugins=citplugs) # Check that citellus.html has been copied assert os.access(os.path.join(tmpdir, 'citellus.json'), os.R_OK) assert os.access(os.path.join(tmpdir, 'citellus.html'), os.R_OK) assert maguiresults # Remove tmp folder shutil.rmtree(tmpdir) shutil.rmtree(tmpdir2) # Process plugin output from multiple plugins new_dict = [] out_dict = [] for item in results: rc = results[item]['result']['rc'] if rc not in sorted({okay, failed, skipped}): print(results[item]) assert rc in sorted({okay, failed, skipped}) if rc == failed or rc == skipped: print(results[item]) assert results[item]['result']['err'] != "" new_dict.append(rc) if results[item]['result']['out'] != "": print(results[item]) assert results[item]['result']['out'] == "" out_dict.append(results[item]['result']['out']) assert sorted(set(new_dict)) == sorted({okay, failed, skipped})
def test_domagui(self): # Call with no arguments res = magui.domagui(sosreports=[], citellusplugins=[]) assert res == {}