Commit Graph

1204 Commits

Author SHA1 Message Date
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
b981b4260d docs: reminder that welcome_handler may be called multiple times 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
Brian Warner
3a289f8912 add tests for Send and Terminator 2017-04-06 12:22:44 -07:00
Brian Warner
e66d2df9f1 test and fix wordlist methods 2017-04-06 12:22:44 -07:00
Brian Warner
3873f55d64 make Input tests pass, clarify error cases, cleanups 2017-04-06 12:22:44 -07:00
Brian Warner
175fef2ab4 clean up wordlist handling 2017-04-06 12:22:44 -07:00
Brian Warner
ae95948c17 more tweaks 2017-04-06 12:22:44 -07:00
Brian Warner
4f1b352b2a more work: allocator, input, shift responsibilities 2017-04-06 12:22:44 -07:00
Brian Warner
79d38da497 split Code into Code/Input/Allocator, ostensibly simpler 2017-04-06 12:22:44 -07:00
Brian Warner
ae8652daf6 code: internal name changes 2017-04-06 12:22:44 -07:00
Brian Warner
0be5aba77d begin worm on new Code machine 2017-04-06 12:22:44 -07:00
Brian Warner
0ddc93110b work on new Code state machine design 2017-04-06 12:22:44 -07:00
Brian Warner
e2c0f08216 minor renames for code-input helper stuff 2017-04-06 12:22:44 -07:00
Brian Warner
299f89c01f new idea on code-input helper API 2017-04-06 12:22:44 -07:00
Brian Warner
4bd9d3579c go back to "input_code" instead of "type_code" 2017-04-06 12:22:44 -07:00