Exemple #1
0
    def test_get_prompt(self):
        # We want to get the prompt, not a disclaimer message
        startup_cfg = StartUpConfig()
        startup_cfg.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 = which('python')[0]

        p = subprocess.Popen([python_executable, 'w3af_console', '-n'],
                             stdout=subprocess.PIPE,
                             stdin=subprocess.PIPE)

        # Wait for the subprocess to start and the prompt to appear
        time.sleep(15)

        expected_prompt = 'w3af>>>'
        prompt = non_block_read(p.stdout)

        msg = 'Failed to find "%s" in "%s" using "%s" as python executable.'
        msg = msg % (expected_prompt, prompt, python_executable)
        self.assertTrue(prompt.startswith(expected_prompt), msg)

        p.kill()
    def test_get_prompt(self):
        # We want to get the prompt, not a disclaimer message
        startup_cfg = StartUpConfig()
        startup_cfg.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 = which('python')[0]
        
        p = subprocess.Popen([python_executable, 'w3af_console', '-n'],
                             stdout=subprocess.PIPE,
                             stdin=subprocess.PIPE)
        
        # Wait for the subprocess to start and the prompt to appear
        time.sleep(15)
        
        expected_prompt = 'w3af>>>'
        prompt = non_block_read(p.stdout)
        
        msg = 'Failed to find "%s" in "%s" using "%s" as python executable.'
        msg = msg % (expected_prompt, prompt, python_executable)
        self.assertTrue(prompt.startswith(expected_prompt), msg)
        
        p.kill()
Exemple #3
0
    def test_which_simple(self):
        python_executables = which('python')

        for exec_name in python_executables:
            self.assertTrue(exec_name.endswith('python'))
Exemple #4
0
 def test_which_simple(self):
     python_executables = which('python')
     
     for exec_name in python_executables:
         self.assertTrue(exec_name.endswith('python'))