functional tests: Make tests compatible with pytest-bdd v4.0

- In pytest-bdd v4.0, given steps are no longer fixtures. Mark steps
  as fixtures when needed.
- Remove 'test_' prefix from step function names, so that pytest doesn't
  run those twice.

Test performed:
- Run all tests, no more pytest-bdd v4.0 related failures
- All the openvpn, snapshot and users module tests pass

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Veiko Aasa authored and Sunil Mohan Adapa committed 2020-12-31 15:41:40 -08:00
1 parent 0a10d02605
commit 1ea6b0b176
3 files changed
+7 -8

No files matched your search

@@ -58,7 +58,7 @@ def new_user_does_not_exist(session_browser, name):
@given(parsers.parse('the user {name:w} exists'))
def test_user_exists(session_browser, name):
def user_exists(session_browser, name):
functional.nav_to_module(session_browser, 'users')
user_link = session_browser.find_link_by_href(
'/plinth/sys/users/{}/edit/'.format(name))
@@ -71,7 +71,7 @@ def test_user_exists(session_browser, name):
@given(
parsers.parse('the admin user {name:w} with password {password:w} exists'))
def test_admin_user_exists(session_browser, name, password):
def admin_user_exists(session_browser, name, password):
functional.nav_to_module(session_browser, 'users')
user_link = session_browser.find_link_by_href('/plinth/sys/users/' + name +
'/edit/')
@@ -82,7 +82,7 @@ def test_admin_user_exists(session_browser, name, password):
@given(parsers.parse('the user {name:w} with password {password:w} exists'))
def user_exists(session_browser, name, password):
def user_exists_with_password(session_browser, name, password):
functional.nav_to_module(session_browser, 'users')
user_link = session_browser.find_link_by_href('/plinth/sys/users/' + name +
'/edit/')