mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-10-26 19:01:39 -04:00
Merge pull request #95 from StruckCroissant/master
Stripping channel whitesapce Signed-off-by: Roland <roland@learningselfreliance.com>
This commit is contained in:
commit
5425142adb
2 changed files with 7 additions and 2 deletions
|
|
@ -49,7 +49,9 @@ def channel_post(_: Request, body: schema.ChannelPostRequest):
|
|||
if not body.directory.is_dir() and body.mkdir:
|
||||
make_media_directory(body.directory)
|
||||
|
||||
channel = lib.create_channel(body.__dict__) # TODO don't use the dataclass as a dict.
|
||||
bd_edit = body.__dict__
|
||||
bd_edit['name'] = bd_edit['name'].strip()
|
||||
channel = lib.create_channel(bd_edit) # TODO don't use the dataclass as a dict.
|
||||
|
||||
# Refresh the videos asynchronously
|
||||
from ..api import refresh_videos
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ class TestVideoAPI(TestAPI):
|
|||
new_channel = dict(
|
||||
directory=channel_directory,
|
||||
match_regex='asdf',
|
||||
name='Example Channel 1',
|
||||
name=' Example Channel 1 ',
|
||||
url='https://example.com/channel1',
|
||||
)
|
||||
|
||||
|
|
@ -67,6 +67,9 @@ class TestVideoAPI(TestAPI):
|
|||
self.assertIsNotNone(created)
|
||||
self.assertIsNotNone(created['id'])
|
||||
|
||||
# Channel name leading/trailing whitespace should be stripped
|
||||
assert created['name'] == 'Example Channel 1'
|
||||
|
||||
# Channel directory should be relative to the media directory
|
||||
assert not pathlib.Path(created['directory']).is_absolute(), \
|
||||
f'Channel directory is absolute: {created["directory"]}'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue