| Commit message (Collapse) | Author | Age | Lines |
| | |
|
| | |
|
| |
|
|
|
|
| |
See the docstring. This does not make the ambition to be powerful
enough to be included in `tests.helpers`, and is only intended
for local purposes.
|
| |\ |
|
| | |\ |
|
| | | |\
| | | |
| | | | |
Make token detection more robust and completely rewrite its tests
|
| | | | |\
| | | | |
| | | | |
| | | | | |
bug/filters/928/non-ascii-token
|
| | | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
It's redundant; there's no benefit here in abstracting two lines of code
into a function.
|
| | | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
This covers the case when a token is matched, but its user ID and
timestamp turn out to be invalid.
|
| | | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
It now supports the changes that switched to finditer, added match
groups, and added the Token NamedTuple. It also accounts for the
is_maybe_token function being removed.
For the sake of simplicity, call assertions on is_valid_user_id and
is_valid_timestamp were not made.
|
| | | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
The function was removed due to redundancy. Therefore, its tests are
obsolete.
|
| | | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
The tests for valid inputs and invalid inputs were split to make them
more readable.
|
| | | | | | |
|
| | | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
`find_token_in_message` now uses the latter so the tests should adjust
accordingly.
|
| | | | | | |
|
| | | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
It has to account for the addition of groups. It's easiest to compare
the entire string so `finditer` is used to return re.Match objects;
the tuples of `findall` would be cumbersome. Also threw in a change
to use `assertCountEqual` cause the order doesn't really matter.
|
| | | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
It was broken due to the addition of groups. Rather than returning the
full match, `findall` returns groups if any exist. The test was
comparing a tuple of groups to the token string, which was of course
failing. Now `fullmatch` is used cause it's simpler - just check for
`None` and don't worry about iterating matches to search.
|
| | | | | | |
|
| | | | | | |
|
| | | | | | |
|
| | | | | | |
|
| | | | | | |
|
| | | | | | |
|
| | | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
The test now ensures the cog is instantiated and that the instance is
passed as an argument to `add_cog`.
|
| | | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
* Remove `bot.get_cog` mocks in `setUp`
* Mock the logger cause it's easier to assert logs
* Remove subtests
* Assert helper functions were called
* Create an autospec for ModLog
|
| | | | | | |
|
| | | | | | |
|
| | | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
* Rely on default values for the author
* Set the content to a non-empty string
|
| | | | | | |
|
| | | | | | |
|
| | | | | | |
|
| | | | | | |
|
| | | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
In practice, this won't ever happen since the regex wouldn't match
strings with missing parts. However, the function does check it so may
as well test it. It's not necessarily bound to always use inputs from
the regex either I suppose.
|
| | | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
The original approach of messing with the `attribute_name` didn't work
for reasons I won't discuss here (would require knowledge of patcher
internals). The new approach doesn't use patch.multiple but mimics it by
applying multiple patch decorators to the function. As a consequence,
this can no longer be used as a context manager.
|
| | | | | | |
|
| | | | | | |
|
| | | | | | |
|
| | | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
It's not possible to test this via asserting the return value of
`on_message` since it never returns anything. Instead, the actual
relevant unit, `find_token_in_message,` should be tested.
|
| | | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
This gives the caller more flexibility. Sometimes attribute names are
too long or they don't follow a naming scheme accepted by the linter.
|
| | | | | | |
|
| | | | | | |
|
| | | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
This helper reduces redundancy/boilerplate by setting default values.
It also has the consequence of shortening the length of the invocation,
which makes it faster to use and easier to read.
|
| | | | | | |
|
| | | |\ \ \
| | | | | |
| | | | | | |
Use Scheduler instead of asyncio.sleep on silence cog
|
| | | | | | | |
|
| | |\ \ \ \ \ |
|
| | | |_|/ / /
| |/| | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
We're gonna need this for the help channel handling, and it seems like a
reasonable type to support anyway. It requires a tiny bit of special
handling, but nothing outrageous.
|
| | | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
This also breaks the helpers import statement into a vertical list,
as the amount of imports has grown too much. I still believe that
this is a preferred alternative to accessing the helpers via module
namespace, as we use them a lot, and the added visual noise would
be annoying to read - their names are already descriptive enough.
|
| | | | | | | |
|
| | | | | | | |
|