samba: Add unit and functional tests

- Add functional tests
- Add unit tests for samba views
- New dependency for running functional tests: smbclient
- Make port configurable for the smbclient

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
This commit is contained in:
Veiko Aasa authored and Joseph Nuthalapati committed 2020-01-17 02:47:06 +05:30
1 parent aa69585cb6
commit 3a202af843
11 files changed
+352 -3

No files matched your search

@@ -602,3 +602,31 @@ def gitweb_repo_privately_writable():
assert application.gitweb_repo_is_writable('Test-repo', with_auth=True)
assert application.gitweb_repo_is_writable('Test-repo', with_auth=True,
url_git_extension=True)
@when(parsers.parse('I {task:w} the {share_type:w} samba share'))
def samba_enable_share(browser, task, share_type):
if task == 'enable':
application.samba_set_share(browser, share_type, status='enabled')
elif task == 'disable':
application.samba_set_share(browser, share_type, status='disabled')
@then(parsers.parse('I can write to the {share_type:w} samba share'))
def samba_share_should_be_writable(share_type):
application.samba_assert_share_is_writable(share_type)
@then(parsers.parse('a guest user can write to the {share_type:w} samba share'))
def samba_share_should_be_writable_to_guest(share_type):
application.samba_assert_share_is_writable(share_type, as_guest=True)
@then(parsers.parse('a guest user can\'t access the {share_type:w} samba share'))
def samba_share_should_not_be_accessible_to_guest(share_type):
application.samba_assert_share_is_not_accessible(share_type, as_guest=True)
@then(parsers.parse('the {share_type:w} samba share should not be available'))
def samba_share_should_not_be_available(share_type):
application.samba_assert_share_is_not_available(share_type)
@@ -347,3 +347,8 @@ def open_main_page(browser):
@then(parsers.parse('the main page should be shown'))
def main_page_is_shown(browser):
assert (browser.url.endswith('/plinth/'))
@given(parsers.parse('the network device is in the {zone:w} firewall zone'))
def networks_set_firewall_zone(browser, zone):
system.networks_set_firewall_zone(browser, zone)