coquelicot: Implement functional tests with uploading file

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Joseph Nuthalapati authored and James Valleroy committed 2018-10-03 19:19:11 -04:00
1 parent 95664015ac
commit c83a3cd22e
5 files changed
+85 -4

No files matched your search

@@ -77,3 +77,9 @@ def new_user_is_listed(browser, name):
@then(parsers.parse('{name:w} should not be listed as a user'))
def new_user_is_not_listed(browser, name):
assert not interface.is_user(browser, name)
@given('a sample local file')
def sample_local_file():
file_path, contents = interface.create_sample_local_file()
return dict(file_path=file_path, contents=contents)
+23 -1
View File
@@ -17,7 +17,7 @@
from pytest_bdd import given, parsers, then, when
from support import site
from support import interface, site
@then(parsers.parse('the {site_name:w} site should be available'))
@@ -56,6 +56,28 @@ def verify_upload_password(browser, password):
site.verify_coquelicot_upload_password(browser, password)
@when(
parsers.parse(
'I upload the sample local file to coquelicot with password {password:w}'
))
def coquelicot_upload_file(browser, sample_local_file, password):
url = site.upload_file_to_coquelicot(
browser, sample_local_file['file_path'], password)
sample_local_file['upload_url'] = url
@when('I download the uploaded file from coquelicot')
def coquelicot_download_file(sample_local_file):
file_path = interface.download_file(sample_local_file['upload_url'])
sample_local_file['download_path'] = file_path
@then('contents of downloaded sample file should be same as sample local file')
def coquelicot_compare_upload_download_files(sample_local_file):
interface.compare_files(sample_local_file['file_path'],
sample_local_file['download_path'])
@then(parsers.parse('the mediawiki site should allow creating accounts'))
def mediawiki_allows_creating_accounts(browser):
site.verify_mediawiki_create_account_link(browser)