Commit Graph

37 Commits

Author SHA1 Message Date
Valentin Lorentz
78dc45e99e Aka: eliminate race condition in tests?
Sometimes (very rarely), the test errors with:

```
======================================================================
FAIL: testHistsearch (Aka.test.AkaChannelTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/supybot/test.py", line 214, in runTest
    originalRunTest()
  File "/usr/lib/python3/dist-packages/supybot/plugins/Aka/test.py", line 67, in testHistsearch
    self.assertResponse('histsearch .*', '@echo foo')
  File "/usr/lib/python3/dist-packages/supybot/test.py", line 402, in assertResponse
    self.assertEqual(m.args[1], expectedResponse,
AssertionError: '@aka add histsearch "last --from [cif true[80 chars]"]]"' != '@echo foo'
- @aka add histsearch "last --from [cif true \"echo test\" \"echo test\"] --regexp [concat \"m/$1/\" [re s/g// \"@2\"]]"
+ @echo foo
 : '@echo foo' != '@aka add histsearch "last --from [cif true \\"echo test\\" \\"echo test\\"] --regexp [concat \\"m/$1/\\" [re s/g// \\"@2\\"]]"'
```

ie. histsearch returns the 'aka add' message instead of the 'echo foo'
one.

My guess is that if they happen too closely to each other, they get
added to the history in the wrong order (how? it's not threaded)

So this commit works around the issue by making the regexp unambiguous.
2021-02-21 00:18:03 +01:00
James Lu
4528a847e4 Aka, Google, String: fix more DeprecationWarning in tests (#1328) 2020-01-26 11:31:28 -08:00
Johannes Löthberg
27e7d6a9ac Aka: Add web UI (#1373)
* utils.web: Import html escaping functions

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>

* Aka: Add web interface for browsing Akas

Fixes #1226.

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>

* httpserver: Actually handle KeyError in unhook

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>

* test: FakeHTTPConnection: Don't decode data in send

BaseHTTPRequestHandler expects to get bytes, so we can't decode the sent
data.

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>

* test: HTTPPluginTestCase: Use BytesIO instead of StringIO

BaseHTTPRequestHandler expects bytes, not strings.

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>

* test: HTTPPluginTestCase: Rewind wfile to 0 before reading the response

Otherwise the read pointer is at the end of the file.

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>

* Aka: Add basic web UI tests

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
2019-10-10 17:27:34 +02:00
Valentin Lorentz
bee98f6711 Conditional: Do not use noReply() after running the command.
As the command already calls reply() or noReply(), calling noReply()
there had disastrous effects:

* if reply() was called, noReply() erases the argument
* if noReply() was called, calling noReply() a second time erases **the next argument** (because the current argument was already erased).

This was 'caused' by the change of behavior of noReply() in 543edccd41.
2017-10-26 09:55:52 +02:00
Valentin Lorentz
543edccd41 Properly handle noReplies() in nested commands.
This fix prevents the bot from replying 'Error: I tried to send you an empty message'
when 'utilities ignore' is called from an Aka.
2017-10-21 15:37:43 +02:00
Valentin Lorentz
0998651f61 Aka: Escape the command in help strings, so they can be copy-pasted into @aka add. 2017-10-01 10:40:23 +02:00
Valentin Lorentz
087fa71d63 Aka: Tell in the help message what channel the aka is for. 2017-08-20 19:55:28 +02:00
Valentin Lorentz
5272bf3a86 Aka: Fix combination of required and optional arguments.
Was broken by 7f43727835 (why?)
2017-08-18 18:30:22 +02:00
Valentin Lorentz
7f43727835 Aka: Proper mitigation of expansion bomb. 2017-04-17 11:05:04 +02:00
Valentin Lorentz
3075a41a3b Aka: Allow more than one in an aka. Closes GH-1283. 2017-04-17 10:53:26 +02:00
James Lu
dbd12e9c0c Aka: allow filtering 'list' by Aka lock status
This adds two mutually incompatible options to Aka list: --locked and --unlocked
2015-08-29 17:21:17 -07:00
Valentin Lorentz
aa98d987a7 Fix imports to minisix. 2015-08-11 17:01:58 +02:00
Valentin Lorentz
c3a2c800f1 Remove need for 2to3. 2015-08-11 16:50:23 +02:00
Valentin Lorentz
be6bc1a734 Remove need for fix_unicode. 2015-08-10 18:52:51 +02:00
James Lu
97228afb7d Aka.search: be case insensitive and handle "not found" errors correctly
Closes #1110.
2015-05-18 14:53:30 -07:00
James Lu
308eea922e Aka: add a 'search' command.
Closes ProgVal/Limnoria#1081.
2015-04-26 22:20:24 -07:00
James Lu
f05f04807d Aka: update tests 2014-12-16 16:40:42 -08:00
Valentin Lorentz
0a1bf6db22 Aka: Add @show command. Closes GH-572. Closes GH-710. 2014-07-13 21:19:48 +02:00
Valentin Lorentz
162b9ef709 Aka: Add length limit of command names in order to limit the number of database queries.
There were a lot of database queries (as much as words in the whole command) for non-aka commands.
2013-12-24 14:38:26 +00:00
Valentin Lorentz
764c788aa6 Revert "Aka: Allow optional arguments and $* together, and also multiple instances of $*."
This reverts commit 774285ef03.

Conflicts:
	plugins/Aka/plugin.py
2013-12-23 17:41:56 +01:00
Valentin Lorentz
01278dc56c Aka: Fix 'factorial-complexity' recursion and command overriding. 2013-12-11 16:01:01 +00:00
Valentin Lorentz
fba38a5df9 Aka: Prevent overriding of other plugins commands. 2013-08-25 01:07:45 +02:00
Valentin Lorentz
73f63c25b9 Aka: Fix import of locked alias. 2013-08-15 10:55:57 +02:00
Valentin Lorentz
d6223eee9d Aka: Remove side effects in everythingReplace and fix crash when evaluating expressions where $* is in the nested command. 2013-08-11 12:02:00 +02:00
Valentin Lorentz
23dfa23f31 Aka: Prevent infinite loop (+ memory bomb) when nesting Akas using $*. 2013-08-08 14:12:02 +02:00
Valentin Lorentz
7f562e15c9 Aka: Fix conflict of test cases of they are run after Alias' tests. 2013-08-01 12:07:19 +02:00
Valentin Lorentz
ba434b1896 Aka: Fix listCommands, which returned tuples instead of strings. 2013-08-01 10:44:19 +02:00
Valentin Lorentz
41581dac2f Aka: Add @importAliasDatabase command. 2013-07-31 19:08:49 +02:00
Valentin Lorentz
d5c0df39f3 Aka: Add recursivity test. 2013-07-24 18:23:51 +02:00
Valentin Lorentz
774285ef03 Aka: Allow optional arguments and $* together, and also multiple instances of $*. 2013-07-24 13:14:25 +02:00
Valentin Lorentz
30596ad79c Aka: Add support for names with spaces in them. 2013-07-24 12:16:02 +02:00
Valentin Lorentz
235854b284 Aka: Fix encoding for Akas with non-ascii characters in the name. 2013-07-24 11:28:55 +02:00
Valentin Lorentz
b2205bc66d Aka: Add test for locked Aka help + bug fixed related to locking and aka use in private. 2013-07-23 23:05:45 +02:00
Valentin Lorentz
201cb459d6 Aka: Remove test that tested a Alias feature that won't be implemented in Aka. 2013-07-23 22:48:38 +02:00
Valentin Lorentz
c49e088879 Aka: Add lock support. 2013-07-23 22:47:50 +02:00
Valentin Lorentz
e9cbb1f60b Add support for adding global or 'other-channel'-specific Akas. 2013-07-23 21:10:26 +02:00
Valentin Lorentz
c2f039c60b Aka: First commit. 2013-07-23 21:02:06 +02:00