-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BUGFIX] Allow space in service names #240
- Loading branch information
Showing
3 changed files
with
39 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Copyright (c) 2020 LINE Corporation | ||
# These sources are released under the terms of the MIT license: see LICENSE | ||
|
||
|
||
from unittest import mock | ||
|
||
from django.core.exceptions import ValidationError | ||
|
||
from promgen import models | ||
from promgen.tests import PromgenTest | ||
|
||
|
||
class ModelTest(PromgenTest): | ||
@mock.patch("django.dispatch.dispatcher.Signal.send") | ||
def setUp(self, mock_signal): | ||
self.user = self.add_force_login(id=999, username="Foo") | ||
|
||
def test_names(self): | ||
# Unicode is ok | ||
models.Service(name=r"日本語", owner=self.user).full_clean() | ||
# Spaces are ok | ||
models.Service(name=r"foo bar", owner=self.user).full_clean() | ||
# dash or under score are ok | ||
models.Service(name=r"foo-bar_baz", owner=self.user).full_clean() | ||
with self.assertRaises(ValidationError): | ||
# Fail a name with \ | ||
models.Service(name=r"foo/bar", owner=self.user).full_clean() | ||
models.Service(name=r"foo\bar", owner=self.user).full_clean() |
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