forked from thomasloupe/Slackord1
-
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validate Discord channel names #39
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The following criteria must be met: * Names must contain only alphanumeric, dash (-), and/or underscore (_) characters * Length must be between 1 and 100 chars (inclusive) * Multiple dashes in a row (e.g. --) are not permitted The actual reality of Discord channel creation is a bit more complex. Empirically, there are numerous (undocumented?) cases where an input channel name does **not** fail to create a channel, but the channel created does not have precisely the same name as the input. For example: * Multiple dashes in a row are converted into a single dash * Space and tilde are converted to dash * Tab and newline are removed * All other symbols are removed For our purposes, this is too complex to deal with, and we will fail to validate any input that does not result in creating a channel with the same name as the input. #24
yeah, that was fast nose2 itself seems to be recommending pytest: https://docs.nose2.io/en/latest/#nose2-vs-pytest https://docs.pytest.org/en/latest/
Which will cause it to be automatically run by the GitHub Actions No need to modify .github/workflows/check.yaml No pytest config yet, just note possible future options
richfromm
commented
Feb 21, 2023
"123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", # noqa: E501 | ||
"1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", # noqa: E501 | ||
]) | ||
def test_valid_channel_name(self, channel_name): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope to add more automated tests later (not right now), this seemed a good place to start.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The following criteria must be met:
The actual reality of Discord channel creation is a bit more complex. Empirically, there
are numerous (undocumented?) cases where an input channel name does not fail to create
a channel, but the channel created does not have precisely the same name as the input. For
example:
For our purposes, this is too complex to deal with, and we will fail to validate any input
that does not result in creating a channel with the same name as the input.
#24