Commit Graph

794 Commits

Author SHA1 Message Date
Brian Warner
9dde091f2b test_wormhole.py: remove dead code 2017-04-16 10:56:17 -04:00
Brian Warner
e6b9cf18be update to match new (private) Automat tracing API 2017-04-13 16:51:04 -04:00
Brian Warner
c2a71e7240 delete leftover/unused/unimportable codes.py
refs #146
2017-04-10 11:33:46 -07:00
Brian Warner
469c94dc4e test_cli: on win32, force en_US.UTF-8 rather than running locale -e 2017-04-07 11:18:32 -07:00
Brian Warner
781d791e03 test server-reconnection: it worked already
Cool, it actually worked without changes. Closes #42
2017-04-07 09:48:48 -07:00
Brian Warner
992db1846c minor TODO comments 2017-04-06 19:44:27 -07:00
Brian Warner
6aa7fe7c82 Welcome: handle local dev versions (with +, not -) correctly
The Welcome class prints a message if the server recommends a CLI version
that's newer than what the client is currently using, but only if the client
is running a "release" version, not a "local" development one. "local"
versions have a "+" in them (at least when Versioneer creates it), but
Welcome was looking for "-" as an indicator. So it was printing the warning
when it shouldn't be.
2017-04-06 19:32:05 -07:00
Brian Warner
1a7b3baaf2 rewrite waiting-for-sender pacifier messages
re-enable the test, and add an extra one

The comments in cmd_send/cmd_receive now enumerate the four cases where we
might notice that things are taking too long, the three cases where we say
something about it, and the two cases where it might be appropriate to give
up automatically (although we don't do that anywhere yet).
2017-04-06 19:17:11 -07:00
Brian Warner
83e55f1f3e add w.when_key(), fix w.when_verified() to fire later
Previously, w.when_verified() was documented to fire only after a valid
encrypted message was received, but in fact it fired as soon as the shared
key was derived (before any encrypted messages are seen, so no actual
"verification" could occur yet).

This fixes that, and also adds a new w.when_key() API call which fires at the
earlier point. Having something which fires early is useful for the CLI
commands that want to print a pacifier message when the peer is responding
slowly. In particular it helps detect the case where 'wormhole send' has quit
early (after depositing the PAKE message on the server, but before the
receiver has started). In this case, the receiver will compute the shared
key, but then wait forever hoping for a VERSION that will never come. By
starting a timer when w.when_key() fires, and cancelling it when
w.when_verified() fires, we have a good place to tell the user that something
is taking longer than it should have.

This shifts responsibility for notifying Boss.got_verifier, out of Key and
into Receive, since Receive is what notices the first valid encrypted
message. It also shifts the Boss's ordering expectations: it now receives
B.happy() before B.got_verifier(), and consequently got_verifier ought to
arrive in the S2_happy state rather than S1_lonely.
2017-04-06 18:27:41 -07:00
Brian Warner
67d53f1388 wordlist: fix "1-word- TAB" case 2017-04-06 15:05:37 -07:00
Brian Warner
3f878fb981 rename test_scripts to test_cli 2017-04-06 12:30:56 -07:00
Brian Warner
e787d0ffc5 move Welcome into test_scripts, remove test_cli 2017-04-06 12:29:58 -07:00
Brian Warner
9717b67d1b comment out serialize() for now
until it's implemented fully
2017-04-06 12:27:06 -07:00
Brian Warner
f957e9b2fb test_wormhole: check when_verified() being called late 2017-04-06 12:26:52 -07:00
Brian Warner
a063ed2b3b remove unused wordlist.py (now lives in _wordlist.py) 2017-04-06 12:23:25 -07:00
Brian Warner
7c6332b770 wormhole: comments 2017-04-06 12:22:45 -07:00
Brian Warner
3cd4d31c0b journal: add test coverage 2017-04-06 12:22:45 -07:00
Brian Warner
df1b2338b1 tests: exercise Key receiving PAKE before set_code 2017-04-06 12:22:45 -07:00
Brian Warner
0da9cbdeeb remove unused code 2017-04-06 12:22:45 -07:00
Brian Warner
d331c51c03 change completion API
* InputHelper returns full words, not just suffixes. I liked the fact that
  suffixes made it impossible to violate the "all matches will start with
  your prefix" invariant, but in practice it was fiddly to work with.
* add ih.when_wordlist_is_available(), so the frontend can block (after
  claiming the nameplate) until it can return a complete wordlist to
  readline. This helps the user experience, because readline wasn't really
  built to work with completions that change over time
* make the Wordlist responsible for appending hyphens to all non-final word
  completions. InputHelper remains responsible for hyphens on nameplates.
  This makes the frontend simpler, but I may change it again in the future if
  it helps non-readline GUI frontends.
* CodeInputter: after claiming, wait for the wordlist rather than returning
  an empty list
* PGPWordList: change to match

This has the unfortunate side-effect that e.g. typing "3-yucatan-tu TAB"
shows you completions that include the entire phrase: "3-yucatan-tumor
3-yucatan-tunnel", rather than only mentioning the final word. I'd like to
fix this eventually.
2017-04-06 12:22:45 -07:00
Brian Warner
04926d0be8 minor test improvement 2017-04-06 12:22:45 -07:00
Brian Warner
4c7b908024 _rlcompleter: improve debug messages and comments 2017-04-06 12:22:45 -07:00
Brian Warner
7699ed2291 tell wordlist how many words to expect, add hyphens to matches
I'm still undecided about whether to add this to the mailbox
properties (revealing it to attackers) or continue to require non-default
wordcounts to be provided as a --code-length= argument to the receiver. So
for now the only place that says count=2 is in the default argument on
get_completions().
2017-04-06 12:22:45 -07:00
Brian Warner
a1f0d1bbf7 debug_set_trace(): cleanups, remove dead code 2017-04-06 12:22:45 -07:00
Brian Warner
bdef446ad4 get mostly-full coverage for rlcompleter, rename, export 2017-04-06 12:22:45 -07:00
Brian Warner
8882e6f64e merge test_wormhole_new into test_wormhole 2017-04-06 12:22:45 -07:00
Brian Warner
8d47194612 check when_version() can be called late as well as early 2017-04-06 12:22:45 -07:00
Brian Warner
580c5a4712 remove unused channel_monitor.py 2017-04-06 12:22:45 -07:00
Brian Warner
6eae5ecf64 better py2/py3 fix, use locale of C.UTF-8 or en_US.UTF-8
This updates the unit tests to checks the system (by running 'locale -a' just
like Click does) to use a UTF-8 -safe locale. It prefers C.UTF-8 if
available, then en_US.UTF-8, then will fall back to any UTF-8 it can find.

My macOS box has en_US.UTF-8 (but not C.UTF-8), and my linux box has
C.UTF-8 (but not en_US.UTF-8). This change doesn't help normal runtime, but
ought to allow the unit tests to run on either platform correctly.
2017-04-06 12:22:45 -07:00
Brian Warner
d0d2992d44 fix some py2-isms that broke py3
This also changes the can-I-run-wormhole check to use C.UTF-8 instead of
en_US.UTF-8, which seems necessary to hush Click on py3. See issue #127 for
more discusson.
2017-04-06 12:22:45 -07:00
Brian Warner
228e0ed671 set_trace: tolerate an Automat that lacks m.setTrace
wormhole.debug_set_trace() won't work until glyph/automat#56 lands, but this
should let travis do its job in the meantime.
2017-04-06 12:22:45 -07:00
Brian Warner
76f5960517 rewrite welcome handler 2017-04-06 12:22:45 -07:00
Brian Warner
152775c5c0 hush pyflakes 2017-04-06 12:22:45 -07:00
Brian Warner
bbef68c11e remove no-longer-relevant tests 2017-04-06 12:22:45 -07:00
Brian Warner
271efb6025 match new Automat tracing API (in glyph/automat#56 PR) 2017-04-06 12:22:45 -07:00
Brian Warner
d44a5335b4 _mailbox: new Automat forbids code in Input bodies 2017-04-06 12:22:45 -07:00
Brian Warner
3ca2720f11 Input: more debug text 2017-04-06 12:22:45 -07:00
Brian Warner
b38d4c94ca Code: deliver got_code to Boss before Key
So when Key sends got_key to Boss, Boss will be ready for it

test_machines: match new delivery order
2017-04-06 12:22:44 -07:00
Brian Warner
0ed363c894 Key: sort messages to ensure got_code lands before got_pake
Since input_code() sets the nameplate before setting the rest of the code,
and since the sender's PAKE will arrive as soon as the nameplate is set, we
could got_pake before got_code, and Key wasn't prepared to handle that.
2017-04-06 12:22:44 -07:00
Brian Warner
17b4ff9893 rework completion, vaguely works 2017-04-06 12:22:44 -07:00
Brian Warner
351a523d0b disable test_slow_text for now 2017-04-06 12:22:44 -07:00
Brian Warner
9267c204e9 test_wormhole_new: oops, forgot yield on assertFailure
This was breaking the last test that gets run (test_xfer_util) because of the
lingering failures.
2017-04-06 12:22:44 -07:00
Brian Warner
07a49bfaca make progress on rlcompleter, still broken 2017-04-06 12:22:44 -07:00
Brian Warner
1b5a0289a8 cmd_send: finally fix when_verified call 2017-04-06 12:22:44 -07:00
Brian Warner
a446d4333e start on new rlcompleter wrapper function 2017-04-06 12:22:44 -07:00
Brian Warner
f0cab020f4 hush some pyflakes 2017-04-06 12:22:44 -07:00
Brian Warner
e82d705764 unbreak other tests 2017-04-06 12:22:44 -07:00
Brian Warner
53a911cc80 finish Boss tests 2017-04-06 12:22:44 -07:00
Brian Warner
d8d305407b start on Boss tests 2017-04-06 12:22:44 -07:00
Brian Warner
bd974f3801 test Nameplate, Mailbox. refactor a little bit 2017-04-06 12:22:44 -07:00