-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added validations for all components names and added and fixed test c…
…ases for the same.
- Loading branch information
1 parent
f9467c0
commit 02224bb
Showing
4 changed files
with
51 additions
and
18 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -107,19 +107,22 @@ def test_add_bot_with_invalid_name(self): | |
account = pytest.account | ||
user = "[email protected]" | ||
is_new_account = True | ||
with pytest.raises(AppException, | ||
match=re.escape("Invalid name! Only letters, numbers, and underscores (_) are allowed.")): | ||
with pytest.raises( | ||
AppException, | ||
match=re.escape("Invalid name! Use only letters, numbers, spaces, hyphens (-), and underscores (_).")): | ||
name = "test#21" | ||
AccountProcessor.add_bot(name=name, account=account, user=user, is_new_account=is_new_account) | ||
|
||
with pytest.raises(AppException, | ||
match=re.escape("Invalid name! Only letters, numbers, and underscores (_) are allowed.")): | ||
with pytest.raises( | ||
AppException, | ||
match=re.escape("Invalid name! Use only letters, numbers, spaces, hyphens (-), and underscores (_).")): | ||
name = "test@3" | ||
AccountProcessor.add_bot(name=name, account=account, user=user, is_new_account=is_new_account) | ||
|
||
with pytest.raises(AppException, | ||
match=re.escape("Invalid name! Only letters, numbers, and underscores (_) are allowed.")): | ||
name = " test 5" | ||
with pytest.raises( | ||
AppException, | ||
match=re.escape("Invalid name! Use only letters, numbers, spaces, hyphens (-), and underscores (_).")): | ||
name = "test&5" | ||
AccountProcessor.add_bot(name=name, account=account, user=user, is_new_account=is_new_account) | ||
|
||
def test_update_bot_with_invalid_name(self): | ||
|
@@ -129,18 +132,21 @@ def test_update_bot_with_invalid_name(self): | |
user = "[email protected]" | ||
is_new_account = True | ||
bot = "test_bot" | ||
with pytest.raises(AppException, | ||
match=re.escape("Invalid name! Only letters, numbers, and underscores (_) are allowed.")): | ||
with pytest.raises( | ||
AppException, | ||
match=re.escape("Invalid name! Use only letters, numbers, spaces, hyphens (-), and underscores (_).")): | ||
name = "test?17" | ||
AccountProcessor.update_bot(name=name, bot=bot) | ||
|
||
with pytest.raises(AppException, | ||
match=re.escape("Invalid name! Only letters, numbers, and underscores (_) are allowed.")): | ||
name = "test-7" | ||
with pytest.raises( | ||
AppException, | ||
match=re.escape("Invalid name! Use only letters, numbers, spaces, hyphens (-), and underscores (_).")): | ||
name = "test(7)" | ||
AccountProcessor.update_bot(name=name, bot=bot) | ||
|
||
with pytest.raises(AppException, | ||
match=re.escape("Invalid name! Only letters, numbers, and underscores (_) are allowed.")): | ||
with pytest.raises( | ||
AppException, | ||
match=re.escape("Invalid name! Use only letters, numbers, spaces, hyphens (-), and underscores (_).")): | ||
name = "<test>18" | ||
AccountProcessor.update_bot(name=name, bot=bot) | ||
|
||
|
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