options.kill -> options.replay_kill_extra

This commit is contained in:
Aldo Cortesi 2016-09-10 09:48:41 +12:00
parent 01cdaf4133
commit b0213a2c0e
9 changed files with 17 additions and 18 deletions

View File

@ -101,7 +101,6 @@ class ServerPlayback(object):
# prefixed with serverplayback_ where appropriate, and playback_ where
# they're shared with client playback.
#
# options.kill
# options.rheaders,
# options.nopop,
# options.replay_ignore_params,
@ -125,7 +124,7 @@ class ServerPlayback(object):
if not self.flowmap and not self.options.keepserving:
self.final_flow = f
self.stop = True
elif self.options.kill:
elif self.options.replay_kill_extra:
ctx.log.warn(
"server_playback: killed non-replay request {}".format(
f.request.url

View File

@ -218,7 +218,7 @@ def get_common_options(args):
anticache=args.anticache,
anticomp=args.anticomp,
client_replay=args.client_replay,
kill=args.kill,
replay_kill_extra=args.replay_kill_extra,
no_server=args.no_server,
refresh_server_playback=not args.norefresh,
rheaders=args.rheaders,
@ -594,8 +594,8 @@ def server_replay(parser):
help="Replay server responses from a saved file."
)
group.add_argument(
"-k", "--kill",
action="store_true", dest="kill", default=False,
"-k", "--replay-kill-extra",
action="store_true", dest="replay_kill_extra", default=False,
help="Kill extra requests during replay."
)
group.add_argument(

View File

@ -148,7 +148,7 @@ class ConnectionItem(urwid.WidgetWrap):
if k == "a":
self.master.start_server_playback(
[i.copy() for i in self.master.state.view],
self.master.options.kill, self.master.options.rheaders,
self.master.options.replay_kill_extra, self.master.options.rheaders,
False, self.master.options.nopop,
self.master.options.replay_ignore_params,
self.master.options.replay_ignore_content,
@ -158,7 +158,7 @@ class ConnectionItem(urwid.WidgetWrap):
elif k == "t":
self.master.start_server_playback(
[self.flow.copy()],
self.master.options.kill, self.master.options.rheaders,
self.master.options.replay_kill_extra, self.master.options.rheaders,
False, self.master.options.nopop,
self.master.options.replay_ignore_params,
self.master.options.replay_ignore_content,

View File

@ -114,7 +114,7 @@ class Options(urwid.WidgetWrap):
select.Option(
"Kill Extra",
"x",
lambda: master.options.kill,
lambda: master.options.replay_kill_extra,
master.options.toggler("kill")
),
select.Option(
@ -165,7 +165,7 @@ class Options(urwid.WidgetWrap):
anticomp = False,
ignore_hosts = (),
tcp_hosts = (),
kill = False,
replay_kill_extra = False,
no_upstream_cert = False,
refresh_server_playback = True,
replacements = [],

View File

@ -191,7 +191,7 @@ class StatusBar(urwid.WidgetWrap):
opts.append("showhost")
if not self.master.options.refresh_server_playback:
opts.append("norefresh")
if self.master.options.kill:
if self.master.options.replay_kill_extra:
opts.append("killextra")
if self.master.options.no_upstream_cert:
opts.append("no-upstream-cert")

View File

@ -30,7 +30,7 @@ class Options(optmanager.OptManager):
anticache=False, # type: bool
anticomp=False, # type: bool
client_replay=None, # type: Optional[str]
kill=False, # type: bool
replay_kill_extra=False, # type: bool
keepserving=True, # type: bool
no_server=False, # type: bool
nopop=False, # type: bool
@ -89,7 +89,7 @@ class Options(optmanager.OptManager):
self.anticomp = anticomp
self.client_replay = client_replay
self.keepserving = keepserving
self.kill = kill
self.replay_kill_extra = replay_kill_extra
self.no_server = no_server
self.nopop = nopop
self.refresh_server_playback = refresh_server_playback

View File

@ -270,7 +270,7 @@ class TestServerPlayback:
def test_server_playback_kill(self):
state = flow.State()
s = serverplayback.ServerPlayback()
o = options.Options(refresh_server_playback = True, kill=True)
o = options.Options(refresh_server_playback = True, replay_kill_extra=True)
m = mastertest.RecordingMaster(o, None, state)
m.addons.add(o, s)

View File

@ -107,7 +107,7 @@ def test_format_keyvals():
def test_options():
assert console.master.Options(kill=True)
assert console.master.Options(replay_kill_extra=True)
class TestMaster(mastertest.MasterTest):

View File

@ -49,14 +49,14 @@ class TestDumpMaster(mastertest.MasterTest):
assert "error" in o.tfile.getvalue()
def test_replay(self):
o = dump.Options(server_replay=["nonexistent"], kill=True)
o = dump.Options(server_replay=["nonexistent"], replay_kill_extra=True)
tutils.raises(exceptions.OptionsError, dump.DumpMaster, None, o)
with tutils.tmpdir() as t:
p = os.path.join(t, "rep")
self.flowfile(p)
o = dump.Options(server_replay=[p], kill=True)
o = dump.Options(server_replay=[p], replay_kill_extra=True)
o.verbosity = 0
o.flow_detail = 0
m = dump.DumpMaster(None, o)
@ -64,13 +64,13 @@ class TestDumpMaster(mastertest.MasterTest):
self.cycle(m, b"content")
self.cycle(m, b"content")
o = dump.Options(server_replay=[p], kill=False)
o = dump.Options(server_replay=[p], replay_kill_extra=False)
o.verbosity = 0
o.flow_detail = 0
m = dump.DumpMaster(None, o)
self.cycle(m, b"nonexistent")
o = dump.Options(client_replay=[p], kill=False)
o = dump.Options(client_replay=[p], replay_kill_extra=False)
o.verbosity = 0
o.flow_detail = 0
m = dump.DumpMaster(None, o)