mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-13 10:30:16 +00:00
samba: cosmetic: Minor yapf fixes
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
31eb35cb9e
commit
7fbc9fc625
@ -55,7 +55,7 @@ SHARES = [
|
|||||||
"mount_point": "/media/root/otherdisk",
|
"mount_point": "/media/root/otherdisk",
|
||||||
"path": "/media/root/otherdisk/FreedomBox/shares/homes/open_share",
|
"path": "/media/root/otherdisk/FreedomBox/shares/homes/open_share",
|
||||||
"share_type": "open"
|
"share_type": "open"
|
||||||
}
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@ -110,14 +110,10 @@ def test_samba_shares_view(rf):
|
|||||||
'/media/root/otherdisk': ['open']
|
'/media/root/otherdisk': ['open']
|
||||||
}
|
}
|
||||||
assert response.context_data['unavailable_shares'] == [{
|
assert response.context_data['unavailable_shares'] == [{
|
||||||
'mount_point':
|
'mount_point': '/media/root/otherdisk',
|
||||||
'/media/root/otherdisk',
|
'name': 'otherdisk',
|
||||||
'name':
|
'path': '/media/root/otherdisk/FreedomBox/shares/homes/open_share',
|
||||||
'otherdisk',
|
'share_type': 'open'
|
||||||
'path':
|
|
||||||
'/media/root/otherdisk/FreedomBox/shares/homes/open_share',
|
|
||||||
'share_type':
|
|
||||||
'open'
|
|
||||||
}]
|
}]
|
||||||
assert response.context_data['users'] == USERS
|
assert response.context_data['users'] == USERS
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
@ -127,8 +123,8 @@ def test_enable_samba_share_view(rf):
|
|||||||
"""Test that enabling share sends correct success message."""
|
"""Test that enabling share sends correct success message."""
|
||||||
form_data = {'filesystem_type': 'ext4', 'open_share': 'enable'}
|
form_data = {'filesystem_type': 'ext4', 'open_share': 'enable'}
|
||||||
mount_point = urllib.parse.quote('/')
|
mount_point = urllib.parse.quote('/')
|
||||||
response, messages = make_request(
|
response, messages = make_request(rf.post('', data=form_data), views.share,
|
||||||
rf.post('', data=form_data), views.share, mount_point=mount_point)
|
mount_point=mount_point)
|
||||||
|
|
||||||
assert list(messages)[0].message == 'Share enabled.'
|
assert list(messages)[0].message == 'Share enabled.'
|
||||||
assert response.status_code == 302
|
assert response.status_code == 302
|
||||||
@ -142,8 +138,8 @@ def test_enable_samba_share_failed_view(rf):
|
|||||||
error_message = 'Sharing failed'
|
error_message = 'Sharing failed'
|
||||||
with patch('plinth.modules.samba.add_share',
|
with patch('plinth.modules.samba.add_share',
|
||||||
side_effect=ActionError(error_message)):
|
side_effect=ActionError(error_message)):
|
||||||
response, messages = make_request(
|
response, messages = make_request(rf.post('', data=form_data),
|
||||||
rf.post('', data=form_data), views.share, mount_point=mount_point)
|
views.share, mount_point=mount_point)
|
||||||
|
|
||||||
assert list(messages)[0].message == 'Error enabling share: {0}'.format(
|
assert list(messages)[0].message == 'Error enabling share: {0}'.format(
|
||||||
error_message)
|
error_message)
|
||||||
@ -155,8 +151,8 @@ def test_disable_samba_share(rf):
|
|||||||
"""Test that enabling share sends correct success message."""
|
"""Test that enabling share sends correct success message."""
|
||||||
form_data = {'filesystem_type': 'ext4', 'open_share': 'disable'}
|
form_data = {'filesystem_type': 'ext4', 'open_share': 'disable'}
|
||||||
mount_point = urllib.parse.quote('/')
|
mount_point = urllib.parse.quote('/')
|
||||||
response, messages = make_request(
|
response, messages = make_request(rf.post('', data=form_data), views.share,
|
||||||
rf.post('', data=form_data), views.share, mount_point=mount_point)
|
mount_point=mount_point)
|
||||||
|
|
||||||
assert list(messages)[0].message == 'Share disabled.'
|
assert list(messages)[0].message == 'Share disabled.'
|
||||||
assert response.status_code == 302
|
assert response.status_code == 302
|
||||||
@ -170,10 +166,11 @@ def test_disable_samba_share_failed_view(rf):
|
|||||||
error_message = 'Unsharing failed'
|
error_message = 'Unsharing failed'
|
||||||
with patch('plinth.modules.samba.delete_share',
|
with patch('plinth.modules.samba.delete_share',
|
||||||
side_effect=ActionError(error_message)):
|
side_effect=ActionError(error_message)):
|
||||||
response, messages = make_request(
|
response, messages = make_request(rf.post('', data=form_data),
|
||||||
rf.post('', data=form_data), views.share, mount_point=mount_point)
|
views.share, mount_point=mount_point)
|
||||||
|
|
||||||
assert list(messages)[
|
assert list(
|
||||||
0].message == 'Error disabling share: {0}'.format(error_message)
|
messages)[0].message == 'Error disabling share: {0}'.format(
|
||||||
|
error_message)
|
||||||
assert response.status_code == 302
|
assert response.status_code == 302
|
||||||
assert response.url == urls.reverse('samba:index')
|
assert response.url == urls.reverse('samba:index')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user