'Strange behaviour when wrapping w3af_console
https://github.com/andresriancho/w3af/issues/1299'

def test_wrapped_w3af(self):

    startup_cfg = StartUpConfig()
    startup_cfg.last_upd = datetime.date.today()
    startup_cfg.set_accepted_disclaimer(True)
    startup_cfg.save()
    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)
    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)
