Skip to content

Commit

Permalink
Merge pull request #6476 from drew2a/feature/tag_spaces_validation
Browse files Browse the repository at this point in the history
Tag System: Verify tag doesn't contain any spaces
  • Loading branch information
drew2a authored Oct 20, 2021
2 parents 37759f7 + 23b69b0 commit c6a56c0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class TagOperation:
def validate(self):
assert MIN_TAG_LENGTH <= len(self.tag) <= MAX_TAG_LENGTH, 'Tag length should be in range [3..50]'
assert not any(ch.isupper() for ch in self.tag), 'Tag should not contain upper-case letters'
assert ' ' not in self.tag, 'Tag should not contain any spaces'

# try to convert operation into Enum
assert TagOperationEnum(self.operation)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,8 @@ async def test_contain_upper_case():
async def test_contain_upper_case_not_latin():
with pytest.raises(AssertionError):
create_message(tag='Тэг').validate()


async def test_contain_any_space():
with pytest.raises(AssertionError):
create_message(tag="tag with space").validate()

0 comments on commit c6a56c0

Please sign in to comment.