Commit Graph

97 Commits

Author SHA1 Message Date
Val Lorentz 23c7c1642b
exhaustive testing of Modern's WHOIS spec (#104)
* Add testWhoisNumerics, to check Modern exhaustively covers known numerics

* ircu2: Workaround for server name in testWhoisNumerics.

* testWhoisUser: Work around ircu2 restrictions on nick and username

* testWhoisNumerics: Add variant with authenticated user

* testWhoisNumerics: Add support for RPL_AWAY and RPL_WHOISSPECIAL

* testWhoisNumerics: Add variant where the WHOIS sender opers up first

* testWhoisUser: Also test with targets

* inspircd: Fix oper configuration

* Fix RPL_WHOISACTUALLY matching for Unreal.
2021-08-29 16:38:38 +02:00
Val Lorentz a9e6605640
Add exhaustive testing of INVITE. (#87)
* Add exhaustive testing of INVITE.

Only tested with Modern, because no one implements the RFC syntax.

* Mark testInviteUnopped* as strict tests.

* Exclude testInviteInviteOnlyModern on Plexus4

* Add test for ERR_USERONCHANNEL.
2021-08-26 21:04:45 +02:00
Val Lorentz 0cf9c37950
Merge pull request #93 from ProgVal/bahamut
Add Bahamut
2021-08-10 18:29:23 +02:00
Valentin Lorentz 42e10c3848 Add an 'external_server' controller 2021-08-10 18:25:35 +02:00
Valentin Lorentz 8744a49073 Make tests pass + update testKeyValidation to match the Modern PR 2021-08-09 23:43:30 +02:00
Valentin Lorentz 0177c369dd Switch from unittest-style to pytest-style test collection
I was to use parametrization in a future test, but pytest doesn't
support it on unittest-style tests.
2021-07-04 17:06:37 +02:00
Valentin Lorentz 2d2e788275 Start adding support for Unreal
Not all tests pass yet, Unreal uses the protocol in ways we did not anticipate.
2021-07-01 23:10:37 +02:00
Valentin Lorentz 2972706ca6 Add a 'services' mark, to allow disabling tests that depend on them. 2021-07-01 17:17:59 +02:00
Valentin Lorentz 7ee3c562d1 Run Atheme with InspIRCd, to enable tests depending on SASL 2021-06-27 16:45:43 +02:00
Valentin Lorentz 48eeeb7312 Always request the 'sasl' cap before using AUTHENTICATE
InspIRCd ignores AUTHENTICATE when the cap is not negotiated.
2021-06-27 14:38:54 +02:00
Valentin Lorentz cc8b9748a7 Always request the 'sasl' cap before using AUTHENTICATE
It's required by InspIRCd.

This commit also adds a check so we don't forget it when testing
locally only with Ergo.
2021-06-27 14:38:54 +02:00
Valentin Lorentz 829edddeb8 Remove some Ergo-specific assumptions.
We need to remove them before we can start running these tests
on Inspircd.
2021-06-27 14:38:54 +02:00
Valentin Lorentz 6458586179 Make find_hostname_and_port its own function
So it can be used to generate multiple ports, which will be needed
to link services.
2021-06-27 00:27:48 +02:00
Valentin Lorentz eef07da56a cases: Stop ignoring the 'msg' parameter in assert* methods 2021-06-27 00:23:21 +02:00
Valentin Lorentz 60e6c013b2 Fix mypy error 2021-06-26 22:11:47 +02:00
Valentin Lorentz 6f68a0d601 Hide irrelevant frames on pytest failures
It makes failures easier to read, by showing only the relevant tests
instead of the helper functions.

https://doc.pytest.org/en/latest/example/simple.html#writing-well-integrated-assertion-helpers
2021-06-26 18:37:44 +02:00
Valentin Lorentz cfe0b0d3dd Add test for message matching commands
+ fix a bug in tested code
+ change conftest.py to allow missing --controller arg (which is
  an UI improvement, as it allows using 'pytest --help' now)
2021-04-18 09:21:27 +02:00
Valentin Lorentz 1e0de7aefb assertMessageMatch: Add pattern-matching on tags, and start using it. 2021-03-01 21:59:50 +01:00
Valentin Lorentz 3f231403ba Use assertMessageMatch whenever possible, and generalize listMatch to accept regexps
it's stricter this way + hopefully more readable and better error msgs
2021-02-28 23:22:31 +01:00
Valentin Lorentz e012c5248b Move list_match to its own module, and prepare generalizing AnyStr 2021-02-28 23:22:31 +01:00
Valentin Lorentz b8867cf4a2 Use a new 'magic' class AnyStr instead of Ellipsis for pattern-matching messages. 2021-02-28 20:44:31 +01:00
Valentin Lorentz 1fbd51c0b5 Rename assertMessageEqual to assertMessageMatch
it describes the function better
2021-02-28 20:44:31 +01:00
Valentin Lorentz 62a87b5957 type-annotate all functions outside the tests themselves. 2021-02-28 18:45:13 +01:00
Valentin Lorentz ac2a37362c Use dataclasses instead of dicts/namedtuples 2021-02-28 18:45:13 +01:00
Valentin Lorentz 12da7e1e3b Enable mypy, and do the minimal changes to make it pass 2021-02-28 18:45:13 +01:00
Valentin Lorentz f7be6cf016 Make all remaining tests not Oragono-specific when relevant. 2021-02-28 09:57:16 +01:00
Valentin Lorentz 8cefc57e61 cases: Get rid of the subcommand/subparams nonsense
Tt was specific to the CAP command but pretended to be generic.

Instead, allow matching on the params argument using Ellipsis.
2021-02-28 08:59:48 +01:00
Valentin Lorentz 51d0ce4483 Remove getIsupport(), it's redundant with server_support 2021-02-27 16:00:28 +01:00
Valentin Lorentz 309a0e45e7 assertMessageEqual: fix error msg 2021-02-27 14:14:08 +01:00
Valentin Lorentz 0352a83a73 Change IRCv3 marks to reference capabilities instead of v3.1 / v3.2 2021-02-27 12:59:28 +01:00
Valentin Lorentz ae09b99d0e Overload the < <= > >= comparison assertion methods. 2021-02-26 21:06:17 +01:00
Valentin Lorentz 0a1ccfec24 Fix assertMessageEqual to actually raise the exception 2021-02-26 21:05:01 +01:00
Valentin Lorentz ff67739c67 Add _IrcTestCase.messageDiffers to allow matching messages without using assertions. 2021-02-26 19:16:24 +01:00
Valentin Lorentz c90141bc61 Use a dedicated 'deprecated' mark instead of add '-deprecated' for each spec
Also rename `@cases.SpecificationSelector.requiredBySpecification("xxx")`
to `@cases.mark_specifications("xxx")` because it's shorter and looks
like pytest's own syntax
2021-02-24 19:19:35 +01:00
Valentin Lorentz 2bd5093df9 Remove strip_first_param argument, it's unused. 2021-02-24 18:19:29 +01:00
Valentin Lorentz 8ea7197f76 Crash when a controlled process stopped instead of waiting forever. 2021-02-24 16:18:08 +01:00
Valentin Lorentz f9d0ec18ff Make flake8 pass, and run it automatically. 2021-02-22 19:42:18 +01:00
Valentin Lorentz 836cc5d6d2 Use isort to order imports. 2021-02-22 19:42:18 +01:00
Valentin Lorentz 8016e01daf Use Black code style 2021-02-22 19:42:18 +01:00
Valentin Lorentz b4873fdea4 Ignore return value of sendall; it's not None on py < 3.6.
https://bugs.python.org/issue25951
2021-02-21 22:05:15 +01:00
Valentin Lorentz 373c705247 Add STS tests. 2021-02-21 22:05:15 +01:00
Valentin Lorentz 85f02c4626 Use pytest as a test runner instead of unit test
'./test <controller> -s spec1 -s spec2' becomes:
'pytest --controller <controller> -k "spec1 or spec2"'

This uses pytest's test selection, which allows finer selection of which tests
to run (for example, it will allow running all tests but those requiring one
feature or combination of features).
It also allows running only a particular test (or set of test) by
filtering on their name or file name.

pytest also shows a much nicer output while testing (grouped by file,
percentage of tests run, manages the verbosity); and it captures all the output
and only shows it if the test fails, which makes --show-io irrelevant.
2021-02-21 18:03:20 +01:00
Valentin Lorentz fe694487c7 Better handling of connections closed by clients. 2021-02-20 10:43:00 +01:00
Shivaram Lingamneni 8d427c80c8 fix stall on failed channel join 2021-02-18 19:35:11 +01:00
Valentin Lorentz 9b2a6a063c Don't pass a 'config' argument to the controller, only Oragono had it.
Instead, annotate tests with the optional features they may need from the IRCd.
2021-02-15 23:29:10 +01:00
Shivaram Lingamneni 706e794df6 test for mute extban 2020-10-21 11:08:14 -04:00
Shivaram Lingamneni 8851083a3e remove limnoria/supybot 2020-09-13 06:38:15 -04:00
Shivaram Lingamneni d490f532c8 add a test for confusable nicks 2020-03-11 06:51:23 -04:00
Shivaram Lingamneni 5073dd7a3d enhanced chathistory test 2020-02-17 04:05:21 -05:00
Shivaram Lingamneni 088d02e8ec expand pyflakes list 2019-02-17 15:39:35 -05:00