def test_save(self): scfg = StartUpConfig(self.CFG_FILE) scfg.last_upd = date.today() scfg.accepted_disclaimer = True scfg.last_commit_id = '3f4808082c1943f964669af1a1c94245bab09c61' scfg.save()
def tearDown(self): XpresserUnittest.tearDown(self) # Just in case... we don't want to break other tests startup_cfg = StartUpConfig() startup_cfg.last_upd = datetime.date.today() startup_cfg.save()
def tearDown(self): XpresserUnittest.tearDown(self) # Just in case... we don't want to break other tests startup_cfg = StartUpConfig() startup_cfg.last_upd = datetime.date.today() startup_cfg.save()
def test_save(self): scfg = StartUpConfig(self.CFG_FILE) scfg.last_upd = date.today() scfg.accepted_disclaimer = True scfg.last_commit_id = '3f4808082c1943f964669af1a1c94245bab09c61' scfg.save()
def test_disclaimer_shown_accept(self): startup_cfg = StartUpConfig() startup_cfg.last_upd = datetime.date.today() - datetime.timedelta(days=3) startup_cfg.save() self.find('update_window') self.click('update') self.find('owasp_top_10_profile')
def test_disclaimer_shown_accept(self): startup_cfg = StartUpConfig() startup_cfg.last_upd = datetime.date.today() - datetime.timedelta( days=3) startup_cfg.save() self.find('update_window') self.click('update') self.find('owasp_top_10_profile')
def test_load_file_exists(self): """This is a test to verify that the things we saved were persited in the actual file. """ # Save scfg = StartUpConfig(self.CFG_FILE) scfg.last_upd = date.today() scfg.accepted_disclaimer = True scfg.last_commit_id = '3f4808082c1943f964669af1a1c94245bab09c61' scfg.save() # Load scfg = StartUpConfig(self.CFG_FILE) self.assertEqual(scfg.last_upd, date.today()) self.assertEqual(scfg.accepted_disclaimer, True) self.assertEqual(scfg.last_commit_id, '3f4808082c1943f964669af1a1c94245bab09c61') self.assertEqual(scfg.freq, 'D')
def test_load_file_exists(self): """This is a test to verify that the things we saved were persited in the actual file. """ # Save scfg = StartUpConfig(self.CFG_FILE) scfg.last_upd = date.today() scfg.accepted_disclaimer = True scfg.last_commit_id = '3f4808082c1943f964669af1a1c94245bab09c61' scfg.save() # Load scfg = StartUpConfig(self.CFG_FILE) self.assertEqual(scfg.last_upd, date.today()) self.assertEqual(scfg.accepted_disclaimer, True) self.assertEqual(scfg.last_commit_id, '3f4808082c1943f964669af1a1c94245bab09c61') self.assertEqual(scfg.freq, 'D')
def test_wrapped_w3af(self): """ Strange behaviour when wrapping w3af_console https://github.com/andresriancho/w3af/issues/1299 """ # Just in case... we don't want to break other tests startup_cfg = StartUpConfig() startup_cfg.last_upd = datetime.date.today() startup_cfg.set_accepted_disclaimer(True) startup_cfg.save() # The easy way to do this was to simply pass 'python' to Popen # but now that we want to run the tests in virtualenv, we need to # find the "correct" / "virtual" python executable using which and # then pass that one to Popen python_executable = sys.executable p = subprocess.Popen([python_executable, 'w3af_console', '-n'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE, shell=False, universal_newlines=True) # Now we run a new ConsoleUI that will load the saved settings. We # should see /tmp/ as the value for msf_location commands_to_run = ['profiles', 'back', 'misc-settings', 'view', 'back', 'exit'] expected_output = 'msf_location' stdout, stderr = p.communicate('\r'.join(commands_to_run) + '\r') msg = 'Failed to find "%s" in "%s" using "%s" as python executable.' msg = msg % (expected_output, stdout, python_executable) self.assertIn(expected_output, stdout, msg)
def test_wrapped_w3af(self): """ Strange behaviour when wrapping w3af_console https://github.com/andresriancho/w3af/issues/1299 """ # Just in case... we don't want to break other tests startup_cfg = StartUpConfig() startup_cfg.last_upd = datetime.date.today() startup_cfg.set_accepted_disclaimer(True) startup_cfg.save() # The easy way to do this was to simply pass 'python' to Popen # but now that we want to run the tests in virtualenv, we need to # find the "correct" / "virtual" python executable using which and # then pass that one to Popen python_executable = sys.executable p = subprocess.Popen([python_executable, 'w3af_console', '-n'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE, shell=False, universal_newlines=True) # Now we run a new ConsoleUI that will load the saved settings. We # should see /tmp/ as the value for msf_location commands_to_run = [ 'profiles', 'back', 'misc-settings', 'view', 'back', 'exit' ] expected_output = 'msf_location' stdout, stderr = p.communicate('\r'.join(commands_to_run) + '\r') msg = 'Failed to find "%s" in "%s" using "%s" as python executable.' msg = msg % (expected_output, stdout, python_executable) self.assertIn(expected_output, stdout, msg)