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

In pytest-bdd v4.0, given steps are no longer fixtures.

- Make gitweb_repo_metadata a fixture.
- Remove errorneous fixture usage from the gitweb_repo_should_not_exist
  step (fixture gitweb_repo returned always None).

Tested that gitweb functional tests pass when using pytest v4.0.2

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Veiko Aasa 2020-12-15 14:43:23 +02:00 committed by James Valleroy
parent e6a858f3fe
commit 9a6fa83376
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -54,7 +54,8 @@ def gitweb_all_repositories_private(session_browser):
_set_all_repos_private(session_browser)
@given(parsers.parse('a repository metadata:\n{metadata}'))
@given(parsers.parse('a repository metadata:\n{metadata}'),
target_fixture='gitweb_repo_metadata')
def gitweb_repo_metadata(session_browser, metadata):
metadata_dict = {}
for item in metadata.split('\n'):
@ -108,8 +109,8 @@ def gitweb_private_repo_should_exists(session_browser):
@then('the repository should not be listed')
def gitweb_repo_should_not_exist(session_browser, gitweb_repo):
assert not _repo_exists(session_browser, gitweb_repo)
def gitweb_repo_should_not_exist(session_browser):
assert not _repo_exists(session_browser, 'Test-repo')
@then('the public repository should be listed on gitweb')